Another way to do this is -
But for this assignment, only the debugging part from my code might be useful
import time #get valid input while True: numList = [] numbers = input('Type your numbers seperated by spaces: ') try: for num in numbers.split(): #debug numbers starting with 0 outputNum = '' zero = True for character in num: if character == '0' and zero: pass else: outputNum += character zero = False int(outputNum) numList.append(outputNum) break except: print('Invalid input detected. Please refer to the message below') #Exit if they typed nothing if not numList: print('If you didn\'t want to use me you could\'ve just clicked the red x') time.sleep(5) quit() #Sort from least to most outputList = [] for x in range(0, len(numList)): num = min(numList) outputList.append(num) numList.remove(num) #print results for output in outputList: print(output)
But for this assignment, only the debugging part from my code might be useful