I’m trying to make a program in python so that when I input a number from 1 to 10, a specific set of program goes on and asks for another number from 1 to 10 and runs another program, until I enter 0(zero) and the program stops.
So my guess was using a while loop but it didn’t quite work out.
JavaScript
x
7
1
user_input = input()
2
user_input = int(user_input)
3
while user_input != 0:
4
(program)
5
else:
6
quit()
7
Advertisement
Answer
Here it is:
JavaScript
1
12
12
1
def program():
2
pass
3
4
5
user_input = int(input())
6
7
while user_input:
8
program()
9
user_input = int(input())
10
11
quit(0)
12