+ 1

Why its showing error ?

print("Enter Password\n\n") psw = input(":") if (psw == "lol"): print("acces granted") else: print("get lost intruder")

26th May 2020, 3:04 AM
Lola
Lola - avatar
7 Antworten
+ 4
What about indentation. Keep it in mind just like another languages uses () for logic and {} for codes. In python indentation and : are used . It will be correct as \/ print("Enter Password\n\n") psw = input(":") if psw == "lol": print("acces granted") else: print("get lost intruder")
26th May 2020, 3:18 AM
Ayush Kumar
Ayush Kumar - avatar
0
𝐊𝐢𝐢𝐛𝐨 𝐆𝐡𝐚𝐲𝐚𝐥 , I am saying you that don't write the code which is violating PEP-8 standard. Your code is correct but it is violating pep standard.
26th May 2020, 5:37 AM
$¢𝐎₹𝔭!𝐨𝓝
$¢𝐎₹𝔭!𝐨𝓝 - avatar
26th May 2020, 5:40 AM
$¢𝐎₹𝔭!𝐨𝓝
$¢𝐎₹𝔭!𝐨𝓝 - avatar
- 2
𝐊𝐢𝐢𝐛𝐨 𝐆𝐡𝐚𝐲𝐚𝐥 Your code is violating PEP-8. One or more statement in single line. Run below code and check the output for line 27. https://code.sololearn.com/cktxB2CQLNJr/?ref=app
26th May 2020, 5:23 AM
$¢𝐎₹𝔭!𝐨𝓝
$¢𝐎₹𝔭!𝐨𝓝 - avatar