-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path4_8.py
More file actions
23 lines (16 loc) · 603 Bytes
/
4_8.py
File metadata and controls
23 lines (16 loc) · 603 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
"""
8. A year is a leap year if it is divisible by 4, except that years divisible by 100 are not leap years
unless they are also divisible by 400. Write a program that asks the user for a year and prints
out whether it is a leap year or not.
"""
year = eval(input('Enter year:'))
if(year%4 == 0):
if(year%100 == 0):
if(year%400 == 0):
print(year,'is leap year')
else:
print(year,'not a leap year')
else:
print(year,'is a leap year')
else:
print(year,'not a leap year')