python - How can I do a break now? -


i began scripting today , don't know pretty much. how end?

passwort = "admin" logout = "logout" versuch = 0  while versuch != passwort:     versuch = str(input("passwort: "))  while versuch !=logout:     print ("menu:logout")     vesuch = str(input(">"))  if str(input) == "logout":     print ("do want logout?")     print("y / n") 

main issue here in second while loop:

while versuch !=logout:     print ("menu:logout")     vesuch = str(input(">")) #precisely here 

you not checking same variable in while loop condition , in assignment, may mistyping mistake (in while loop condition is: versuch, , in assignment vesuch). should change in assignment versuch

another mistake here, here:

if str(input) == "logout": 

you not calling input function here getting reference, need add parenthesis call function: input()

last thing, use raw_input() instead of input() avoid explicitly adding double quotations in user input otherwise not match, code, if enter : admin , not match, if enter "admin" work, don't want bother user each time add double quotations input, right? don't need str() function if use raw_input() because returns string


Comments

Popular posts from this blog

Email notification in google apps script -

c++ - Difference between pre and post decrement in recursive function argument -

javascript - IE11 incompatibility with jQuery's 'readonly'? -