from random import randint
a = [randint(0,99) for i in range(10)]
for i in range(len(a)):
minimum = i
for j in range(i + 1, len(a)):
if a[j] < a[minimum]:
minimum = j
a[minimum], a[i] = a[i], a[minimum]
print(a)
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
from random import randint
a = [randint(0,99) for i in range(10)]
for i in range(len(a)):
minimum = i
for j in range(i + 1, len(a)):
if a[j] < a[minimum]:
minimum = j
a[minimum], a[i] = a[i], a[minimum]
print(a)