-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathex056.py
More file actions
32 lines (28 loc) · 758 Bytes
/
Copy pathex056.py
File metadata and controls
32 lines (28 loc) · 758 Bytes
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
27
28
29
30
31
32
media = 0
mulher_nova = 0
nome_velho = ''
idade_velho = 0
conta_homem = 0
for p in range(1, 5):
print(f'---- {p}ª pessoa ----')
nome = input('Nome: ')
idade = int(input('Idade: '))
sexo = input('Sexo [F/M]: ').upper()
media += idade
if sexo == 'F':
if idade < 20:
mulher_nova += 1
if sexo == 'M':
conta_homem += 1
if idade > idade_velho:
idade_velho = idade
nome_velho = nome
print(f'A média de idade do grupo é de {media/4:.2f} anos')
if mulher_nova == 0:
pass
else:
print(f'Ao todo são {mulher_nova} mulher(es) com menos de 20 anos.')
if conta_homem == 0:
pass
else:
print(f'O homem mais velho se chama {nome_velho} e tem {idade_velho} anos.')