Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def is_leap(year):
- if year % 4 == 0:
- if year % 100 == 0:
- if year % 400 == 0:
- return True
- else:
- return False
- else:
- return True
- else:
- return False
- def days_in_month():
- if month > 12 or month < 1:
- return "Invalid Month"
- month_days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
- if is_leap(year) and month == 2:
- return 29
- return month_days[month -1]
- # Do NOT change any of the code below
- year = int(input("Enter a year: "))
- month = int(input("Enter a month: "))
- days = days_in_month(year, month)
- print(days)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement