I am writing a code where the user inputs as many numbers as they want until they input Stop. Each input gets added to a list. I want the input to be integer so the inputs are able to be sorted correctly but then when 'Stop' is inputted an error message will be created. But if I make the input string then the numbers will be sorted incorrectly.
Here is the code:
Num_List = list()
Numbers = input('Enter a number: ')
Num_List.append(Numbers)
Num_B = False
while Num_B == False:
Numbers = input('Enter a number: ')
Num_List.append(Numbers)
if Numbers == 'Stop':
Num_List.remove('Stop')
Num_List = [i for i in Num_List if i is not '']
Num_List.sort(reverse=False)
sorted(Num_List)
print(Num_List)
Num_B = True