Take input from the user print the day according to the number.

In this python if else program, we will take input from the user between 1 to 7 and print the day according to the number.

Criteria:
1 – Sunday
2- Monday
3 – Tuesday
4 – Wednesday
5 – Thursday
6 – Friday
7 – Saturday

Steps to solve the program
  1. Take a number between 1-7 as input.
  2. Using if-else statements print the day according to the number (i.e. 1-Sunday, 2-Monday,….,7-Saturday)
				
					num = int(input("Enter a number: "))

if num == 1:
    print("Sunday")
elif num == 2:
    print("Monday")
elif num == 3:
    print("Tuesday")
elif num == 4:
    print("Wednesday")
elif num == 5:
    print("Thursday")
elif num == 6:
    print("Friday")
elif num == 7:
    print("Saturday")
else:
    print("Invalid number")
				
			

Output :

				
					Enter a number: 5
Thursday
				
			

Related Articles

accept the car price of a car and display the road tax to be paid

accept the city name and display its monuments

Leave a Comment