Question #178325

Write a program to get numbers as input from the user and save them in a list. The program should keep getting the input until they type, Quit. If they typed Quit, it should stop asking for the input and should print the number they have typed. 


Expert's answer

#!/usr/bin/env pyhton
numbers = []

while True:
    s = input('Enter a number or "Quit" to exit: ')
    if s == 'Quit':
        break
    x = int(s)
    numbers.append(x)

print('The number you have enterd:')
for x in numbers:
    print(x, end=' ')

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS