soberfish

christmas

Jan 27th, 2021
666
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. total = 0
  2. leap_year = None
  3. days = [0, 31, None, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
  4.  
  5. current_year = int(input("What is the current year? "))
  6.  
  7. current_month = int(input("What is the current month (1-12)? "))
  8. if current_month > 12 or current_month <= 0:
  9.     quit()
  10.  
  11. current_day = int(input("What is the current day? "))
  12.  
  13. if current_year % 4 == 0:
  14.     days[2] = 29
  15.     leap_year = True
  16. else:
  17.     days[2] = 28
  18.     leap_year = False
  19.  
  20. if current_day <= 0 or current_day > 31:
  21.     quit()
  22. if leap_year == True:
  23.     if current_month == 2 and current_day > 29:
  24.        quit()
  25. else:
  26.     if current_month == 2 and current_day > 28:
  27.         quit()
  28.  
  29. for x in range(current_month, 12+1):
  30.     total = total + days[x]
  31.  
  32. total = total - (current_day + (31-25))
  33.  
  34. if total < 0:
  35.     if leap_year == True:
  36.         total = 366 + total
  37.     elif leap_year == False:
  38.         total = 365 + total
  39.  
  40. print("There are " + str(total) + " days until Christmas!")
  41.  
RAW Paste Data