python 3.x - How can i get this loop to keep repeating until the right number is entered -
so im having issue basic code cant give me second output. basically, have code need type number between 1 , 20. if input outside of range have got let me try again. issue is, when try input second attempt, ends code after input rather giving feedback.ni show u code here.
number = int (input ("write number between 1 , 20")) if number > 20: input ("please input again") elif number < 1: input ("please input again") else: print ("thank you")
you must using loop , condition. can try code...
number=int(input("write number between 1 , 20: ")) while (number>20 or number<1): number=int(input("please input again: ")) if number>=1 , number<=20: print ("thank you") break
Comments
Post a Comment