Write a program that reads integers from the user and stores them in a list. Yourprogram should continue reading values until the user enters 0. Then it should display all of the values entered by the user (except for the 0) in order from smallest to largest,with one value appearing on each line.
a = list()
while True:
val = int(input())
if val != 0:
a.append(val)
else:
a.sort()
for i in a:
print(i)
break
Comments
Leave a comment