题解 | #取号#

取号

http://www.nowcoder.com/practice/2a61684ea405441eb9e572705defebdc

NP35 取号

思路:

step1:对应输入输出即可;注意条件的判断;

代码如下:

while True:
    try:
        print( "Welcome! How many people, please?\nEnter 'quit' to end the program.")
        n = input()
        if n == 'quit':
            break
        else:
            n = int(n)
            if n <= 4:
                print('Your small table is reserved!')
            elif 4 < n <= 6:
                print('Your middle table is reserved!')
            elif 6 < n <= 10:
                print('Your large table is reserved!')
            elif n > 10:
                print('Sorry, there is no free table that seats over ten persons.')
    except:
        break
全部评论

相关推荐

龙珠传说:nb,公务员解约不需要支付违约金吧
点赞 评论 收藏
分享
不愿透露姓名的神秘牛友
06-29 17:30
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务