-
Notifications
You must be signed in to change notification settings - Fork 0
/
exercise056.py
26 lines (23 loc) · 756 Bytes
/
exercise056.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
sumage = 0
averageage = 0
bageman = 0
nameold = ''
totalwoman = 0
for p in range(1, 5):
print('----- {} PEOPLE -----'.format(p))
name = str(input('Name: ')).strip()
age = int(input('Age: '))
gender = str(input('Gender [M/F]: ')).strip()
sumage += age
if p == 1 and gender in 'Mm':
bageman = age
nameold = name
if gender in 'Mm' and age > bageman:
bageman = age
nameold = name
if gender in 'Ff' and age < 20:
totalwoman += 1
averageage = sumage / 4
print('The average age of the group is {} years.'.format(averageage))
print('The oldest man is {} years old and his name is {}.'.format(bageman, nameold))
print('Altogether there are {} women under 20 years old.'.format(totalwoman))