Last active
October 24, 2017 23:06
-
-
Save ysnerdem/6b1a12593da74569bc81c3c1e5739f3a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print('Please enter numbers') | |
print('You can terminate by entering -1 when you enter as many numbers as you want') | |
numbers = [] | |
sorted_nums = [] | |
while True: | |
num = int(input('Number:')) | |
numbers.append(num) | |
if num == -1: | |
break | |
while numbers: | |
max = numbers [0] | |
for i in numbers: | |
if i > max: | |
max = i | |
sorted_nums.append(max) | |
numbers.remove(max) | |
print(sorted_nums) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment