password protection error!pls help | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson

password protection error!pls help

this is the code: user=input("enter your username:") if user == bob: print("correct username") else print("wrong username") i get indentation error i tried all i could but it dosent get fixed

17th Aug 2020, 4:57 PM
47 HACKER - avatar
2 Answers
+ 2
you forgot to put ':' on else statement and also the else statement should also be the level of indentation. here's the fixed code. user=input("enter your username:") if user == bob: #don't forget to give the value of bob variable. print("correct username") else: print("wrong username").
17th Aug 2020, 5:04 PM
Rellot's screwdriver
Rellot's screwdriver - avatar
if and else must be in the level of indentation. bob is not defined anywhere, should be "bob". user = xxxxxx if user == "bob" : xxxxxx else: xxxxxx
17th Aug 2020, 5:01 PM
Bahhaⵣ - avatar