Помогите пожалуйста с задачами Найти минимальное нечётное число из случайного набора чисел(Сгенерировать случайный набор чисел) пример: import random
numbers = []
counter = 0
while counter <= 10:
numbers.append(random.randint(1, 100))
counter += 1
max_number = -99999999999
for number in numbers:
if (number >= max_number) and ((number % 2) == 0):
max_number = number
print(numbers)
print(max_number) Отсортировать список от большему к меньшему не используя функцию sort() пример:
import random
numbers = []
numbers_sorted = []
counter = 0
while counter < 10:
numbers.append(random.randint(1, 1000))
counter += 1
print(numbers)
while len(numbers) != 0:
min_number = 9999999999
for number in numbers:
if number < min_number:
min_number = number
numbers.remove(min_number)
numbers_sorted.append(min_number)
print(numbers_sorted)
numbers = []
counter = 0
while counter <= 10:
numbers.append(random.randint(1, 100))
counter += 1
max_number = -99999999999
for number in numbers:
if (number >= max_number) and ((number % 2) == 0):
max_number = number
print(numbers)
print(max_number) Отсортировать список от большему к меньшему не используя функцию sort() пример:
import random
numbers = []
numbers_sorted = []
counter = 0
while counter < 10:
numbers.append(random.randint(1, 1000))
counter += 1
print(numbers)
while len(numbers) != 0:
min_number = 9999999999
for number in numbers:
if number < min_number:
min_number = number
numbers.remove(min_number)
numbers_sorted.append(min_number)
print(numbers_sorted)