Can any body help me ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can any body help me ?

Hey Guys, I am new to python and i wanted to make a little program and i got confused at something :: input("choose a number between 1 and 9") So, i want to make a code that stops the user when he chooses a number >9 .

22nd Jun 2020, 9:40 PM
Amine Abdouli
2 Answers
+ 5
while True: a=int(input("choose number 1 and 9")) if a>9: break
22nd Jun 2020, 9:58 PM
Abhay
Abhay - avatar
+ 2
1. Assign a variable to your input, IE: x = int(input()) Then set up an if/else statement, IE: if x > 9: print("Your number is too big") else: The code you want to happen on nums between 1 & 9
22nd Jun 2020, 9:59 PM
Rik Wittkopp
Rik Wittkopp - avatar