-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathex056.py
More file actions
23 lines (23 loc) · 832 Bytes
/
Copy pathex056.py
File metadata and controls
23 lines (23 loc) · 832 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
somaidade = 0
mediaidade = 0
maioridadehomem = 0
nomevelho = ''
totmulher20 = 0
for p in range(1,5):
print('----- {}ª PESSOA -----'.format(p))
nome = str(input('Nome: ')).strip()
idade = int(input('Idade: '))
sexo = str(input('Sexo [M/F]: ')).strip()
somaidade = somaidade + idade
if p == 1 and sexo in 'Mm':
maioridadehomem = idade
nomevelho = nome
if sexo in 'Mm' and idade > maioridadehomem:
maioridadehomem = idade
nomevelho = nome
if sexo in 'Ff' and idade < 20:
totmulher20 = totmulher20 + 1
mediaidade = somaidade / 4
print('A média de idade do grupo é de {} anos'.format(mediaidade))
print('O homem mais velho tem {} anos e se chama {}. '.format(maioridadehomem, nomevelho))
print('Ao todo são {} mulheres com menos de 20 anos'.format(totmulher20))