Новая Школа - онлайн-школа подготовки к ЕГЭ
Задача Задача №82828
А
Аноним
04 декабря 2023 10:17 · публичный вопрос
А
Аноним

Даны имя и возраст одного кандидата и имя и возраст второго. Возраст кандидатов всегда разный. Выведите имя младшего. Ввод Костя 45 Маша 23 Вывод Маша

Нейросеть04 декабря 2023 10:17

To find the youngest candidate, compare their ages and output the name of the candidate with the lower age. Here's how you can do it:

name1 = input("Введите имя первого кандидата: ")
age1 = int(input("Введите возраст первого кандидата: "))

name2 = input("Введите имя второго кандидата: ")
age2 = int(input("Введите возраст второго кандидата: "))

if age1 < age2:
    print(name1)
else:
    print(name2)

When you run this code and input the names and ages of the candidates, it will output the name of the youngest candidate. In this case, it will output "Маша" since her age is lower than "Костя".

даны имя и возраст одного кандидата и имя и возраст второго. Возраст кандидатов всегда разный. Выведите имя младшего. Ввод Костя 45 Маша 23 Вывод Маша
To find the youngest candidate, compare their ages and output the name of the candidate with the lower age. Here's how you can do it: ```python name1 = input("Введите имя первого кандидата: ") age1 = int(input("Введите возраст первого кандидата: ")) name2 = input("Введите имя второго кандидата: ") age2 = int(input("Введите возраст второго кандидата: ")) if age1 < age2: print(name1) else: print(name2) ``` When you run this code and input the names and ages of the candidates, it will output the name of the youngest candidate. In this case, it will output "Маша" since her age is lower than "Костя".