Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# OpenBootCampPython
Repository to store Python boot camp.
* Ejercicio 5: Escribe una función que pueda decirte si un año (número entero) es bisiesto o no.
* Path: 'src/ExerciseFive/isBisiesto.py'
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-i https://pypi.org/simple
setuptools==65.5.0 ; python_version >= '3.7'
wheel==0.38.0
15 changes: 15 additions & 0 deletions src/exercisefive/bisiesto.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
def isbisiesto(year):
"""Script to check if an input year is leap year
:param year: year to check if is leap year
:type year: int
:return: True if is leap year, False if is not
:rtype: bool
"""
if year % 4 != 0:
return False
elif year % 100 != 0:
return True
elif year % 400 != 0:
return False
else:
return True
17 changes: 17 additions & 0 deletions src/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from src.exercisefive.bisiesto import isbisiesto


def main():
"""Main script for exercise five
:return: None
:rtype: NoneType
"""
year = input('Introduzca un año: ')
if isbisiesto(int(year)):
print('El año ' + year + ' es bisiesto')
else:
print('El año ' + year + ' no es bisiesto')


if __name__ == '__main__':
main()