1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 ages = [] names = ["Антон", "Борис", "Виктор"] for name in names: ages.append(int(input("Возраст {}а: ".format(name j = 0 M = [] m = max(ages) for age in ages: if age == m: M.append(j) j += 1 if len(M) == 1: print("{} старше всех.".format(names[M[0]])) elif len(M) == 2: for i, v in enumerate(names): if i not in M: young = v print("{} и {} старше {}а.".format(names[M[0]], names[M[1]], young))
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
ages = []
names = ["Антон", "Борис", "Виктор"]
for name in names:
ages.append(int(input("Возраст {}а: ".format(name
j = 0
M = []
m = max(ages)
for age in ages:
if age == m:
M.append(j)
j += 1
if len(M) == 1:
print("{} старше всех.".format(names[M[0]]))
elif len(M) == 2:
for i, v in enumerate(names):
if i not in M:
young = v
print("{} и {} старше {}а.".format(names[M[0]], names[M[1]], young))