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 -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -