Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- total = 0
- leap_year = None
- days = [0, 31, None, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
- current_year = int(input("What is the current year? "))
- current_month = int(input("What is the current month (1-12)? "))
- if current_month > 12 or current_month <= 0:
- quit()
- current_day = int(input("What is the current day? "))
- if current_year % 4 == 0:
- days[2] = 29
- leap_year = True
- else:
- days[2] = 28
- leap_year = False
- if current_day <= 0 or current_day > 31:
- quit()
- if leap_year == True:
- if current_month == 2 and current_day > 29:
- quit()
- else:
- if current_month == 2 and current_day > 28:
- quit()
- for x in range(current_month, 12+1):
- total = total + days[x]
- total = total - (current_day + (31-25))
- if total < 0:
- if leap_year == True:
- total = 366 + total
- elif leap_year == False:
- total = 365 + total
- print("There are " + str(total) + " days until Christmas!")
Add Comment
Please, Sign In to add comment