Advertisement
naren_paste

check_season

Jan 29th, 2024
994
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.51 KB | Source Code | 0 0
  1. def get_season(month):
  2.     if month in [3, 4, 5]:
  3.         return "Spring"
  4.     elif month in [6, 7, 8]:
  5.         return "Summer"
  6.     elif month in [9, 10, 11]:
  7.         return "Autumn"
  8.     elif month in [12, 1, 2]:
  9.         return "Winter"
  10.     else:
  11.         return "Invalid month number"
  12.  
  13. def main():
  14.     month_number = int(input("Enter the month number (1-12): "))
  15.     season = get_season(month_number)
  16.     print("The season for month", month_number, "is", season)
  17.  
  18. if __name__ == "__main__":
  19.     main()
  20.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement