Last active
July 15, 2023 00:03
-
-
Save okanharenan/5b5f18bf853a768c6f3ffa18923103ac to your computer and use it in GitHub Desktop.
pycharm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
somaidade=0 | |
médiaidade=0 | |
maioridadehomem=0 | |
nomevelho=0 | |
totmulher20=0 | |
for c in range(1,5): | |
print('----- {}° pessoa -----'.format(c)) | |
nome=str(input('nome:')).strip() | |
idade=int(input('idade:')) | |
sexo=input('sexo:') | |
somaidade += idade | |
if c == 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 += 1 | |
médiaidade=somaidade/4 | |
print('a media de idade do grupo é {:.1f}'.format(médiaidade)) | |
print('o homem mais velho do grupo é o {} ele tem {}'.format(nomevelho,maioridadehomem)) | |
print('ao todo são {} mulheres no grupo com menos de 20 anos'.format(totmulher20)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment