Created
September 11, 2019 00:40
-
-
Save flfelipelopes/0fd793e98e2c264675a055342dde2202 to your computer and use it in GitHub Desktop.
Cálculo de ano bissexto.
This file contains 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
#Descubra se o ano informado é bissexto ou não | |
import datetime | |
print('=====ESSE É UM ANO BISSEXTO?=====') | |
print('') | |
print('Vamos descobrir se um determinado ano é bissexto ou não?') | |
ano = int(input('Para isso, digite um ano aleatório ou 0 para utilizar o ano atual: ')) | |
print('') | |
if ano == 0: | |
ano = datetime.date.today().year | |
if ano % 4 == 0 and ano % 100 != 0 or ano % 400 == 0: | |
print('O ano de {} é um ano bissexto.'.format(ano)) | |
else: | |
print('O ano de {} não é um ano bissexto.'.format(ano)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment