summaryrefslogtreecommitdiff
path: root/comp/work/31/bubble.py
diff options
context:
space:
mode:
Diffstat (limited to 'comp/work/31/bubble.py')
-rw-r--r--comp/work/31/bubble.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/comp/work/31/bubble.py b/comp/work/31/bubble.py
new file mode 100644
index 0000000..c45f903
--- /dev/null
+++ b/comp/work/31/bubble.py
@@ -0,0 +1,22 @@
+import sys
+
+
+def sort(list):
+ length = len(list)
+ for i in range(length - 1):
+ for j in range(length - i - 1):
+ if list[j] > list[j+1]:
+ tmp = list[j]
+ list[j] = list[j+1]
+ list[j+1] = tmp
+ return list
+
+
+if __name__ == "__main__":
+ count = int(sys.argv[1])
+
+ num = []
+ for i in range(count):
+ num.append(int(input(f"number {i}: ")))
+
+ print(sort(num))