From 9956d79f0f4ee9d08aeab6b88d4916402d0e540e Mon Sep 17 00:00:00 2001 From: tlizri Date: Thu, 3 Nov 2022 11:40:17 +0100 Subject: [PATCH 1/7] Initial commit --- src/main.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/main.py diff --git a/src/main.py b/src/main.py new file mode 100644 index 0000000..019ce9b --- /dev/null +++ b/src/main.py @@ -0,0 +1,16 @@ +# This is a sample Python script. + +# Press Mayús+F10 to execute it or replace it with your code. +# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings. + + +def print_hi(name): + # Use a breakpoint in the code line below to debug your script. + print(f'Hi, {name}') # Press Ctrl+F8 to toggle the breakpoint. + + +# Press the green button in the gutter to run the script. +if __name__ == '__main__': + print_hi('PyCharm') + +# See PyCharm help at https://www.jetbrains.com/help/pycharm/ From ebd999830855c0bd940924d9f1653881817c806e Mon Sep 17 00:00:00 2001 From: tlizri Date: Fri, 4 Nov 2022 12:49:25 +0100 Subject: [PATCH 2/7] Added requirements.txt --- requirements.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 requirements.txt diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..e4f81fa --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +-i https://pypi.org/simple From f535585f529e761652f162ecac7efd64f1960a5e Mon Sep 17 00:00:00 2001 From: tlizri Date: Fri, 4 Nov 2022 13:18:49 +0100 Subject: [PATCH 3/7] Resolve package versions --- requirements.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/requirements.txt b/requirements.txt index e4f81fa..ee2bf11 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1,3 @@ -i https://pypi.org/simple +setuptools==65.5.0 ; python_version >= '3.7' +wheel==0.38.0 From 8a6f4dd2b4250836caef3267f88cbd0570f2f95a Mon Sep 17 00:00:00 2001 From: tlizri Date: Mon, 7 Nov 2022 13:39:11 +0100 Subject: [PATCH 4/7] Change main prototype --- src/main.py | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/main.py b/src/main.py index 019ce9b..a53c62e 100644 --- a/src/main.py +++ b/src/main.py @@ -1,16 +1,6 @@ -# This is a sample Python script. +def main(): + pass -# Press Mayús+F10 to execute it or replace it with your code. -# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings. - -def print_hi(name): - # Use a breakpoint in the code line below to debug your script. - print(f'Hi, {name}') # Press Ctrl+F8 to toggle the breakpoint. - - -# Press the green button in the gutter to run the script. if __name__ == '__main__': - print_hi('PyCharm') - -# See PyCharm help at https://www.jetbrains.com/help/pycharm/ + main() From b529d8a3de28db9be6333b48f267fe962c5ecfc8 Mon Sep 17 00:00:00 2001 From: Izri Toufali Lapaz Date: Tue, 8 Nov 2022 11:03:49 +0100 Subject: [PATCH 5/7] Update README.md Updated readme for exercise five. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index fa0237d..951fb49 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,3 @@ # OpenBootCampPython Repository to store Python boot camp. +* Escribe una función que pueda decirte si un año (número entero) es bisiesto o no. From 8a0d6dbe90dd458e32cd4159652d2d0726cfd090 Mon Sep 17 00:00:00 2001 From: tlizri Date: Tue, 8 Nov 2022 11:35:26 +0100 Subject: [PATCH 6/7] Completed exercise five --- src/ExerciseFive/isBisiesto.py | 9 +++++++++ src/main.py | 9 ++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 src/ExerciseFive/isBisiesto.py diff --git a/src/ExerciseFive/isBisiesto.py b/src/ExerciseFive/isBisiesto.py new file mode 100644 index 0000000..78a8692 --- /dev/null +++ b/src/ExerciseFive/isBisiesto.py @@ -0,0 +1,9 @@ +def isBisiesto(year): + if year % 4 != 0: + return False + elif year % 100 != 0: + return True + elif year % 400 != 0: + return False + else: + return True diff --git a/src/main.py b/src/main.py index a53c62e..03f18a8 100644 --- a/src/main.py +++ b/src/main.py @@ -1,5 +1,12 @@ +import ExerciseFive.isBisiesto as e5 + + def main(): - pass + year = input('Introduzca un año: ') + if e5.isBisiesto(int(year)): + print('El año ' + year + ' es bisiesto') + else: + print('El año ' + year + ' no es bisiesto') if __name__ == '__main__': From 5a767261e3ded82d73ce30ce746b3fbc310c226f Mon Sep 17 00:00:00 2001 From: tlizri Date: Tue, 8 Nov 2022 14:43:00 +0100 Subject: [PATCH 7/7] Added docstring and renamed folder --- README.md | 3 ++- src/ExerciseFive/isBisiesto.py | 9 --------- src/exercisefive/bisiesto.py | 15 +++++++++++++++ src/main.py | 8 ++++++-- 4 files changed, 23 insertions(+), 12 deletions(-) delete mode 100644 src/ExerciseFive/isBisiesto.py create mode 100644 src/exercisefive/bisiesto.py diff --git a/README.md b/README.md index 951fb49..2050495 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ # OpenBootCampPython Repository to store Python boot camp. -* Escribe una función que pueda decirte si un año (número entero) es bisiesto o no. +* 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' diff --git a/src/ExerciseFive/isBisiesto.py b/src/ExerciseFive/isBisiesto.py deleted file mode 100644 index 78a8692..0000000 --- a/src/ExerciseFive/isBisiesto.py +++ /dev/null @@ -1,9 +0,0 @@ -def isBisiesto(year): - if year % 4 != 0: - return False - elif year % 100 != 0: - return True - elif year % 400 != 0: - return False - else: - return True diff --git a/src/exercisefive/bisiesto.py b/src/exercisefive/bisiesto.py new file mode 100644 index 0000000..d5c2471 --- /dev/null +++ b/src/exercisefive/bisiesto.py @@ -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 diff --git a/src/main.py b/src/main.py index 03f18a8..95a267c 100644 --- a/src/main.py +++ b/src/main.py @@ -1,9 +1,13 @@ -import ExerciseFive.isBisiesto as e5 +from src.exercisefive.bisiesto import isbisiesto def main(): + """Main script for exercise five + :return: None + :rtype: NoneType + """ year = input('Introduzca un año: ') - if e5.isBisiesto(int(year)): + if isbisiesto(int(year)): print('El año ' + year + ' es bisiesto') else: print('El año ' + year + ' no es bisiesto')