Judge week

Judge week

Each week the corresponding English words are different, from Monday to Sunday words were: monday, tuesday, wednesday, thursday, friday, saturday, sunday.

Implement program
the first two characters of the input word, word determines whether the input of the week, and outputs a corresponding word; if the character does not match the input, the output error.

# 请使用 input() 输入单词的前两个字母 chars
chars = input()

# 请判断输入的是星期几,并输出对应的单词
if chars!="mo" and chars!="tu" and chars!="we" and chars!="th" and chars!="fr" and chars!="sa" and chars!="su":
    print("error")
else:
    if chars=="mo":
        print("monday")
    elif chars=="tu":
        print("tuesday")
    elif chars=="we":
        print("wednesday")
    elif chars=="th":
        print("thursday")
    elif chars=="fr":
        print("friday")
    elif chars=="sa":
        print("saturday")
    elif chars=="su":
        print("sunday")
      
Published 74 original articles · won praise 25 · views 10000 +

Guess you like

Origin blog.csdn.net/qq_43191251/article/details/104338864