Files
2025-09-15 21:09:48 +05:00

36 lines
1.2 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# TODO здесь писать код
def fill_size_list(number, whose: str):
collection = []
if whose == 'skates':
text_first = 'Размер '
text_last = '-й пары: '
else:
text_first = 'Размер ноги '
text_last = '-го человека: '
for i in range(1, number + 1):
collection.append(int(input(f'{text_first}{i}{text_last}')))
return collection
number_sizes_skates = int(input("Кол-во коньков: "))
skates_size_list = fill_size_list(number_sizes_skates, 'skates')
print()
number_sizes_legs = int(input('Кол-во людей: '))
legs_size_list = fill_size_list(number_sizes_legs, 'legs')
print()
# Я так и не понял, для чего искать наименьший подходящий размер... :(
# skates_size_list.sort()
# legs_size_list.sort()
count_busy = 0
for leg in legs_size_list:
for i_skate, skate in enumerate(skates_size_list):
if leg == skate:
skates_size_list[i_skate] = 0
count_busy += 1
break
print('Наибольшее кол-во людей, которые могут взять ролики:', count_busy)