+ 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 ?

5th Apr 2020, 4:07 PM
Adnan Ahmad
Adnan Ahmad - avatar
4 odpowiedzi
+ 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.
5th Apr 2020, 4:12 PM
maf
maf - avatar
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 !
6th Apr 2020, 5:22 AM
Adnan Ahmad
Adnan Ahmad - avatar
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")
6th Apr 2020, 5:26 AM
maf
maf - avatar
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")
6th Apr 2020, 5:28 AM
maf
maf - avatar