https://github.com/wakolivotes/lux-academy-check-leap-year
Project: Write a python program that checks whether a year is leap year or not. You are required to use nested if...else to solve this problem. ]
https://github.com/wakolivotes/lux-academy-check-leap-year
Last synced: 2 months ago
JSON representation
Project: Write a python program that checks whether a year is leap year or not. You are required to use nested if...else to solve this problem. ]
- Host: GitHub
- URL: https://github.com/wakolivotes/lux-academy-check-leap-year
- Owner: wakoliVotes
- License: gpl-3.0
- Created: 2022-02-20T04:25:49.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-02-20T10:55:43.000Z (over 3 years ago)
- Last Synced: 2025-01-28T03:22:04.471Z (4 months ago)
- Language: Python
- Size: 21.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Lux-Academy: Script to Check if Entered Year is a Leap
#### Overview
- A python program that checks whether a year is leap year or not
- You are required to use nested if...else to solve this problem.
- Note: A leap year is exactly divisible by 4 except for century years (years ending with 00).
- The century year is a leap year only if it is perfectly divisible by 400**Python Script**
```py
def check_leap():
# We need only integers as input, hence use try...except combination
try:
year = int(input("Hi, Enter the Year:"))
if year % 400 == 0:
print("This is Not a Leap year, this is a Century Year")
elif year % 4 == 0:
print(f"Yes, {year} is a leap year")
else:
print(f"{year} is not a leap year")
except ValueError:
print("Invalid Input, Enter a Proper year")# If the user enters an invalid input, the function is called again
return check_leap()# Function Call
check_leap()```