3 回答
TA贡献1878条经验 获得超4个赞
days =["Sunday" ,"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
user_input = int(input("Enter Day (from 1-7)"))
if user_input:
print (days[user_input-1])
else:
print ("Your input is not valid")
带着字典
days_dict ={'1':"Sunday" ,'2':"Monday",'3':"Tuesday", '4':"Wednesday", '5':"Thursday", '6':"Friday", '7':"Saturday"}
print (days_dict[input("Enter Day (from 1-7): ")])
TA贡献1845条经验 获得超8个赞
days =["Sunday" ,"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
user_input = int(input("Enter Day"))
print (days[user_input - 1])
这会有所帮助
TA贡献2011条经验 获得超2个赞
day_number = int(input("Enter day number: "))
days = {
1:'SUNDAY',
2:'MONDAY',
3:'TUESDAY',
4:'WEDNESDAY',
5:'THURSDAY',
6:'FRIDAY',
7:'SATURDAY'
}
print(days.get(day_number))
添加回答
举报