Python Flow Controls Not Working -


ok in have issue if answer "n" still continue else statement. how fix this? (this in function, edit: other if statements work fine)

 if command == "exit":     exit = 1     while exit == 1:         print("quit? y/n:", end="")         ex = input()         if ex == "y":             quit()         elif ex == "n":             break         else:             print("err") 

the code seems work fine.

i assumed want : on entering exit ask user y or n if user enters y quit program if user enters n want break out of while loop. works fine both cases can add else question illustrate problem.

i recommend try using return statnment while trying break multiple loop or if creating function purpose.

make sure not entering small alphabets . can use .upper() function make sure use uppercase.


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -