In this python if else program, we will read month and returns season for that month.
Condition for the season:
Summer – February, March, April, May
Rainy – June, July, August, September
Winter – Octomber, November, December, January
Steps to solve the program
- Read the month from the user.
- Using an if-else statement print the season for the input month
month = input("Enter a month: ")
if month == "February" or month == "March" or month == "April" or month == "May":
print("Summer")
elif month == "June" or month == "July" or month == "August" or month == "September":
print("Rainy")
else:
print("Winter")
Output :
Enter a month: February
Summer
Related Articles
Python program to check whether the input number is divisible by 12 or not.
Python program to check whether the input number is a square of 6 or not.
Python program to check whether the input number is a cube of 3 or not.
Python program to check whether two numbers are equal or not.
Python program to check whether the given input is a complex type or not.