From ee8190f533c71220d607d207251d2c359136f960 Mon Sep 17 00:00:00 2001 From: Rahul-learner <66640990+Rahul-learner@users.noreply.github.com> Date: Sat, 8 Oct 2022 16:10:15 +0000 Subject: [PATCH 1/2] A Python program to check if a year if leap year or not --- leapYear_Check.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 leapYear_Check.py diff --git a/leapYear_Check.py b/leapYear_Check.py new file mode 100644 index 00000000..acec747c --- /dev/null +++ b/leapYear_Check.py @@ -0,0 +1,25 @@ +year = input("Type the year which you want to check...\n") + +def checkLeapYear(year): + leapYear = False + Year = int(year) + if Year % 4 == 0: + if Year % 100 == 0: + if Year % 400 == 0: + leapYear = True + elif Year % 400 != 0: + leapYear = False + + elif Year % 100 != 0: + leapYear = True + elif Year % 400 == 0: + leapYear = True + + return leapYear + +isLeapYear = checkLeapYear(year) +print(isLeapYear) +if isLeapYear == True: + print(f"yes {year} is a leap Year.") +else: + print(f"No, {year} is not a leap Year.") \ No newline at end of file From 28590c08157ac1dcdf294c1856304d70e1bdc093 Mon Sep 17 00:00:00 2001 From: Rahul-learner <66640990+Rahul-learner@users.noreply.github.com> Date: Sat, 8 Oct 2022 16:42:47 +0000 Subject: [PATCH 2/2] Moved the leap year function to function folder. --- Hactoberfest2020/Write_a_function.py | 9 --------- leapYear_Check.py => Hactoberfest2020/leapYear_Check.py | 0 2 files changed, 9 deletions(-) delete mode 100644 Hactoberfest2020/Write_a_function.py rename leapYear_Check.py => Hactoberfest2020/leapYear_Check.py (100%) diff --git a/Hactoberfest2020/Write_a_function.py b/Hactoberfest2020/Write_a_function.py deleted file mode 100644 index c6b3dcca..00000000 --- a/Hactoberfest2020/Write_a_function.py +++ /dev/null @@ -1,9 +0,0 @@ -def is_leap(year): - leap = False - - # Write your logic here - - return leap - -year = int(input()) -print(is_leap(year)) \ No newline at end of file diff --git a/leapYear_Check.py b/Hactoberfest2020/leapYear_Check.py similarity index 100% rename from leapYear_Check.py rename to Hactoberfest2020/leapYear_Check.py