can anyone tell me why when I put 0 the programm work when I put negatif number or greater than 10000 there is nothing happen | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

can anyone tell me why when I put 0 the programm work when I put negatif number or greater than 10000 there is nothing happen

x= int (input("enter a number")) while x < 10000: if x > 10000: print("error number greater than 10000") elif x< 0: print ("eerreur negatif number ") elif x==0 : break print("programme end "

24th Sep 2018, 5:33 AM
mbappe08
1 Answer
- 1
there’s quite a few things you need to check here. - make sure there are no whitespaces between the function name and the parenthesis. e.g,: int(input(...)) - i’m not sure what logic you want in your code, but it seems you dont need the while loop in there. - your if-elif conditions are not covering the case when x is between 0 and 10000, so nothing will happen if user inputs value in that range. - practice better indentation - end you functions with the closing parenthesis. e.g., the last print statement happy debugging =)
24th Sep 2018, 5:56 AM
James