Example
Input
5
Output
Week day: - Friday
Required to Know
Use of Variables, Use of different operators like assignment or arithmetic operators, Use of functions like print(), and input(), Use of If-else, and Use of Data types.
Steps
Take a day as input from the user.
We know that 1 week == 7 days. So in the condition assume that Monday is the first day of the week. Now we will print Monday if the day is equal to 1.
Similarly apply the condition for the corresponding days and print the respective name.
Program
day = int(input("enter the day"))
if(day==1):
print("Week day 1: - Monday")
elif(day==2):
print("Week day 2: - Tuesday")
elif(day==3):
print("Week day 3: - Wednesday")
elif(day==4):
print("Week day 4: - Thursday")
elif(day==5):
print("week day 5: - Friday")
elif(day==6):
print("week day 6: - Saturday")
else:
print("Sunday")