234k views
4 votes
Test if a password entered is correct. The secret phrase is Ada Lovelace. Sample Run 1 Enter the Password: Ada Lovelace Sample Output 1 Correct! Sample Run 2 Enter the Password: Blaise Pascal Sample Output 2 Not Correct

2 Answers

3 votes

Final answer:

The question regards the creation of a program to verify if a user-entered password matches the designated secret phrase 'Ada Lovelace' using conditional statements.

Step-by-step explanation:

The question you're asking involves writing a simple program or logic statement to test if a password is correct. In this scenario, the secret phrase to access a system is 'Ada Lovelace'. A correct program would involve a comparison between the user input and the secret phrase. If the input matches 'Ada Lovelace', it would return 'Correct!'. Otherwise, it would return 'Not Correct'. This is a fundamental practice in learning about password validation and conditional statements in programming.

User Daniel Antos
by
6.0k points
2 votes

Answer:

a1="Ada Lovelace"

a2= input("Enter Password: ")

def checkpassword(a2):

if a2 == a1:

print("Correct Password")

else:

print("Wrong Password")

return 0

Step-by-step explanation:

The string as password is given. Now we ask the user to input the password, and this is compared to the original password. If the passwords match, print password matched, or else print wrong password.

User Nova
by
5.3k points