You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Faça um programa que leia o ano de nascimento de um jovem e informe, de acordo com a sua idade, se ele ainda vai se
2
-
# alistar ao serviço militar, se é a hora exata de se alistar ou se já passou do tempo do alistamento. Seu programa também deverá mostrar o tempo que falta ou que passou do prazo.
1
+
# Write a program that reads the year of birth of a young person and informs, according to his age, whether he is
2
+
# still going to enlist in the military service, whether it is the exact time to enlist or if it is past the
3
+
# enlistment period. Your program should also show the time remaining or the time that has passed.
4
+
3
5
fromdatetimeimportdate
4
6
fromxml.sax.handlerimportproperty_interning_dict
5
7
6
-
atual=date.today().year
7
-
nasc=int(input('Digite o ano do seu nascimento:'))
8
-
idade=atual-nasc
9
-
print('Quem nasceu em {} tem {} anos.'.format(nasc, idade))
10
-
ifidade==18:
11
-
print('Você deve se alistar IMEDIATAMENTE.')
12
-
elifidade<18:
13
-
saldo=18-idade
14
-
print('ainda faltam {} anos para o seu alistamento.'.format(saldo))
15
-
elifidade>18:
16
-
saldo=idade-18
17
-
print('Você já deveria ter se alistado há {} anos.'.format(saldo))
8
+
year=date.today().year
9
+
birth=int(input('Enter your year of birth:'))
10
+
age=year-birth
11
+
print(f'Who was born in {birth} is {age} years old.')
12
+
ifage==18:
13
+
print('You must enlist IMMEDIATELY!!')
14
+
elifage<18:
15
+
result=18-age
16
+
print(f'Still missing {result} years for your enlistment.')
17
+
elifage>18:
18
+
result=age-18
19
+
print(f'You should have enlisted {result} years ago.')
0 commit comments