Advertisement
BusinessBurrito

3.12 LAB Seasons

Jul 13th, 2022
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.24 KB | None | 0 0
  1. input_month = input()
  2. input_day = int(input())
  3.  
  4. spring = ('March', 'April', 'May', 'June')
  5. spring_s = ('April', 'May')
  6. summer = ('June', 'July', 'August', 'September')
  7. summer_s = ('July', 'August')
  8. autumn = ('September', 'October', 'November', 'December')
  9. autumn_s = ('October', 'November')
  10. winter = ('December', 'January', 'February', 'March')
  11. winter_s = ('January', 'February')
  12. valid_months = ('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December')
  13. month_long = ('January', 'March', 'May', 'July', 'August', 'October', 'December')
  14. month_short = ('April', 'June', 'September', 'November')
  15.  
  16. if not (1 <= input_day <= 31) or not (input_month in valid_months):
  17.     print('Invalid')
  18. if (input_month in month_short) and (input_day > 30):
  19.     print('Invalid')
  20. elif input_month in spring:
  21.     if (input_month in spring_s):
  22.         print('Spring')
  23.     if ((input_month == 'March') and (31 >= input_day > 20)) or ((input_month == 'June') and (1 <= input_day <= 20)):
  24.         print('Spring')
  25.     if (input_month == 'March') and (0 < input_day < 21):
  26.         print('Winter')
  27.     if (input_month == 'June') and (20 < input_day < 31):
  28.         print('Summer')
  29. elif input_month in summer:
  30.     if input_month in summer_s:
  31.         print('Summer')
  32.     if ((input_month == 'June') and (20 < input_day < 31)) or ((input_month == 'September') and (21 <= input_day < 31)):
  33.         print('Summer')
  34.     if (input_month == 'June') and (1 <= input_day < 21):
  35.         print('Spring')
  36.     if (input_month == 'September') and (21 < input_day < 31):
  37.         print('Autumn')
  38. elif input_month in autumn:
  39.     if input_month in autumn_s:
  40.         print('Autumn')
  41.     if ((input_month == 'September') and (22 <= input_day < 31)) or ((input_month == 'December') and (1 <= input_day <= 20)):
  42.         print('Autumn')
  43.         pass
  44.     pass
  45. elif input_month in winter:
  46.     if ((input_month in winter_s) and (1 <= input_day <=31)):
  47.         print('Winter')
  48.     if ((input_month == 'December') and (20 < input_day < 31)) or ((input_month == 'March') and (1 <= input_day <= 19)):
  49.         print('Winter')
  50.     if input_month == 'December':
  51.         print('Autumn')
  52.     if input_month == 'March':
  53.         print('Spring')
  54.  
  55.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement