Answer:
mylist = [] #Create an empty list
i = 0 # initialize counter to 0
b = int(input("Enter into list: ")) # prompt user for input
while not(b == 0): #test if input is not 0
mylist.append(b) #insert input into list if it's not 0
i = i + 1 #increment counter
b = int(input("Enter into list: ")) #prompt user for input
#save sorted list in a newlist
newlist = sorted(mylist)
#print element on separate lines
for ind in newlist:
print(ind)
#End of program
Step-by-step explanation:
Line 1 of the program creates an empty list named mylist
Line 2, initializes a counter variable i to 0
Line 3 prompts user for input
Line 4 to 7 iterates until user input is 0
Line 9 sorts the list and saves the sorted list into a new list
Line 11 & 12 prints the each element of the list on separate lines