Answer to Question #197923 in Python for Frost

Question #197923

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. 


1
Expert's answer
2021-05-24T07:42:57-0400
a = list()
while True:
    val = int(input())
    if val != 0:
        a.append(val)
    else:
        a.sort()
        for i in a:
            print(i)
        break

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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS