Відповідь:
a = [9, 5, 7, 3, 1, 8, 6, 2, 4, 0, 15, 12, 19, 10, 11, 18, 17, 13, 16, 14]
n = len(a)
for i in range(n - 1):
for j in range(n - i - 1):
if a[j] > a[j + 1]:
a[j], a[j + 1] = a[j + 1], a[j]
print(a)
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Відповідь:
a = [9, 5, 7, 3, 1, 8, 6, 2, 4, 0, 15, 12, 19, 10, 11, 18, 17, 13, 16, 14]
n = len(a)
for i in range(n - 1):
for j in range(n - i - 1):
if a[j] > a[j + 1]:
a[j], a[j + 1] = a[j + 1], a[j]
print(a)