Q:

Write a Python program that keeps a number from the user (between 1 and 7) and displays the name of the weekday. Example : Input number: 3 Output : Wednesday

0

Write a Python program that keeps a number from the user (between 1 and 7) and displays the name of the weekday. Example : Input number: 3 Output : Wednesday

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

lst = ["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]

n = int(input("Input number: "))

if n>=1 and n<=7:
    print(lst[n-1])

else:
    print("Invalid input")

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now