In this python if else program, we will check authentication of username and password. The name and password of the user should be the same to be valid
Steps to solve the program
- Take Username and password as input through the user.
- If the username and password is equal then it is authenticate.
- Use if-else statement for this purpose.
- Print the output.
# Take username and password as input through the user
name = input("Enter name: ")
password = input("Enter password: ")
# Authenticate username and password
if name == password:
# Print output
print("It is valid")
else:
# Print output
print("It is not valid")
Output :
Enter name: sanket
Enter password: 1234
It is not valid
Related Articles
Python program to validate user_id in the list of user_ids.
Python program to print a square or cube if the given number is divided by 2 or 3 respectively.
Python program to describe the interview process.
Python program to determine whether a given number is available in the list of numbers or not.
Python program to find the largest number among three numbers.
Python program to check any person eligible to vote or not.