-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcadastros.py
More file actions
33 lines (33 loc) · 1.06 KB
/
cadastros.py
File metadata and controls
33 lines (33 loc) · 1.06 KB
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
33
from datetime import date
count = 0
male = 0
female = 0
ano = date.today().year
maiores = 0
mmaiordeXanos = 0
while True:
count += 1
nome = str(input('Digite o Nome: '))
nascimento = int(input(f'Digite o ano de nascimento de {nome}: '))
sexo = str(input(f'Escolha o sexo de {nome} [M/F]: ')).strip().lower()[0]
idade = ano - nascimento
if sexo not in 'mf':
sexo = str(input(f'Escolha o sexo de {nome} [M/F]: ')).strip().lower()[0]
if sexo == 'm':
male += 1
if sexo == 'f':
female += 1
if idade > 18:
maiores += 1
if sexo == 'f':
if idade > 20:
mmaiordeXanos += 1
c = str(input('Deseja continuar? [S/N]')).strip().lower()[0]
if c not in 'sn':
c = str(input('Deseja continuar? [S/N]')).strip().lower()[0]
if c in 'Nn':
break
print(f'Total de {count} pessoas cadastradas com sucesso.')
print(f'Dessas, {maiores} pessoas são maiores de 18 anos.')
print(f'Foram cadastrados {male} homens.')
print(f'Foram cadastradas {mmaiordeXanos} mulheres com mais de 20 anos.')