码迷,mamicode.com
首页 > 其他好文 > 详细

8.请输入星期几的第一个字母来判断一下是星期几,如果第一个字母一样,则继续判断第二个字母

时间:2018-07-02 20:23:29      阅读:174      评论:0      收藏:0      [点我收藏+]

标签:星期六   put   输入   sda   else   coding   sunday   lib   input   

#encoding=utf-8

week_num=raw_input("input:")

 

if week_num.lower()=="m":

   print "today is monday"

 

elif week_num.lower()=="w":

   print "today is wednesday"

 

elif week_num.lower()=="f":

   print "today is friday"

 

 

elif week_num.lower()=="t":

   week_num2=raw_input("input Second letters :")

   if week_num2.lower()=="u":

        print "today is tuesday"

   elif week_num2.lower()=="h":

        print "today is thursday"

   else:

       print "None !"

 

elif week_num.lower()=="s":

   week_num2=raw_input("input Second letters :")

   if week_num2.lower()=="a":

        print "today is saturday"

   elif wweek_num2.lower()=="u":

        print "today is sunday"

   else:

       print "None !"

 

else:

   print "None !"

 

 

 

#encoding=utf-8

week_day={"m":u"星期一","tu":u"星期二","w":u"星期三","th:u"星期四","f:u"星期五""sa:u"星期六""su:u"星期日"}

input_letter=raw_input("input the abbriviation of week day:")

#print type(input_letter)

#print input_letter

#print input_letter.lower()#把大写变小写

if week_day.has_key(input_letter.lower()):

    print week_day[input_letter.lower()]

else:

    input_second_letter=raw_input("input second letter:")

    input_letter=input_letter+input_second_letter

    if week_day.has_key(input_letter.lower()):

        print week_day[input_letter.lower()]

    else:

        print "you input wrong letters,try again!"

8.请输入星期几的第一个字母来判断一下是星期几,如果第一个字母一样,则继续判断第二个字母

标签:星期六   put   输入   sda   else   coding   sunday   lib   input   

原文地址:https://www.cnblogs.com/luo25236240/p/9255401.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!