+ 1
Help me in Python !
https://code.sololearn.com/cd32azMNPSLz/?ref=app What should I enter instead of 'ANYTHING' so when I enter any value it should print correct ?
4 Réponses
+ 4
Adnan Ahmad Your forgot to wrap ANYTHING with quotation marks.
"ANYTHING"
if s == "ANYTHING":
print("Wrong")
else:
print("Correct")
ELSE means anything other than the condition provided above.
0
I want to print answer correct but its printing wrong , I need it for another use . Like there is an app and it have a list of authorized users , but I want anyone can use it so I need to enter a value which authorize all users !
0
Adnan Ahmad It is printing the opposite answers because you have wrote the conditions opposite. Compare ur code with mine.
Now next question:
You want to store many user ids and if you will ask for user ids and if it matches with any of the user ids that you provided, print logged in correct?
a = input("Enter user id: ")
if a == "John" or a == "Mary" or a == "Bob" or a == "Kevin":
print("Logged in")
else:
print("Incorrect username")
0
Since u mentioned list, this is the way.
users = ["Bob","Kevin","Mary","John"]
a = input("Enter username: ")
if a in users:
print("Logged in")
else:
print("Incorrect Username")