Write a program in python to display the name of the day according to the number given by the user.write the output also
Answers
Answered by
16
Answer:
# Taken day number from user weekday = int(input("Enter weekday day number (1-7) : ")) if weekday == 1 : print("\nMonday"); elif weekday == 2 : print("\nTuesday") elif(weekday == 3) : print("\nWednesday") elif(weekday == 4) : print("\nThursday") elif(weekday == 5) : print("\nFriday") elif(weekday == 6) : print("\ .
Answered by
0
A program in python to display the name of the day according to the number given by the user
Python Code
days =["Sunday" ,"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
user_input = int(input("Enter Day"))
if user_input == (1,2,3,4,5,6,7) :
print (days[0,1,2,3,4,5,6])
- Data values are kept as key:value pairs in dictionaries. A dictionary is a group of items that are unique, changing, and ordered*. Dictionary entries are sorted as of Python version 3.7. Dictionaries are unordered in Python versions 3.6 and older.
- A collection of things in a Python dictionary is not sorted. A dictionary has a key/value pair for each entry. When the key is known, dictionaries are designed to retrieve values quickly.
#SPJ2
Similar questions