project_python/2.3_lesson.8.20.py
2025-12-15 13:54:12 +05:00

24 lines
1,000 B
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.

****Задание 8 Параграф 2.3***
**** Ваша скорость, внимание к деталям и аккуратность — всё это впечатляет.
А теперь — в детский сад!
Там ребята придумали новую игру: каждый называет какое-нибудь число, а тот, чьё число имеет наибольшую сумму цифр, выигрывает.
Судьёй выбрали бедную воспитательницу, и она попросила вас о помощи... ну как тут откажешь?****
if name == "main":
count = int(input())
best_name = ''
best_sum = 0
for i in range(count):
name = input()
number = int(input())
summa = 0
while number > 0:
summa += number % 10
number //= 10
if summa >= best_sum:
best_sum = summa
best_name = name
print(best_name)