Infinite loop in Python cannot stop -


i tried loop keeps giving me infinite loop can me ?

difficulty = int (input ( '"1" easy \n"2" medium \n"3" hard\n'))  while difficulty <= 0 or difficulty >= 4 :   print ('invalid choice. try again!') 

you printing while difficulty within range. problem difficulty variable set once, before loop. try moving inside loop.


Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

asp.net core mvc - How important is the global.json and src folder? -

c++ - Using Gtest how return different values in ON_CALL? -