Advertisement
Guest User

cadastro.py3

a guest
Jan 12th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.96 KB | None | 0 0
  1. c1,c2='\033[36m', '\033[33m'
  2. maior = homens = mulheres = 0
  3. while True:
  4.     print(c1+ '{:=^60}'.format( ' CADASTRE UMA PESSOA '))
  5.     idade = int(input(c1+'Idade: '+c2))
  6.     sexo = []
  7.     while sexo not in ('m', 'f'):
  8.         sexo = str(input(c1+ 'Sexo: [M/F] ' +c2)).strip().lower()[0]
  9.         if sexo != 'm' and sexo != 'f':
  10.             print(c1+ '==============================' * 2)
  11.             print(c2+ 'Opção incorreta tente outra vez!')
  12.             print(c1+ '==============================' * 2)
  13.     if idade >= 18: maior += 1
  14.     if sexo == 'm': homens += 1
  15.     if sexo == 'f' and idade < 20: mulheres += 1
  16.     print(c1+ '==============================' * 2)
  17.     resposta = []
  18.     while resposta not in ('s', 'n'):
  19.         resposta = str(input(c1+ 'Deseja continuar? [S/N]: ' +c2)).strip().lower()[0]
  20.     if resposta == 'n':
  21.         break
  22. print(c1+ '==============================' * 2)
  23. print(c2+ (f'Total de pessoas com mais de 18 anos: {maior}'))
  24. print(c2+ (f'Total de homens: {homens}'))
  25. print(c2+ (f'Total de mulheres com menos de 20 anos: {mulheres}'))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement