Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions projects/001-sorted-order/python/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
integers_list=[]

integer=1
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we can find a better way to handle the user input also without using list.pop?


while integer!=0:
try:
integer=int(input("Enter an integer (0 to quit): "))
integers_list.append(integer)

except ValueError:
print("Invalid integer!")
continue
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not needed

integers_list.pop()
for integer in sorted(integers_list):
print(integer)