name = ''#名字为空即代表False while not name:#not name=False即 真,将执行循环体 print('Enter your name:') name = input()#给name赋值,如输入了空以外值,不会再有下一个循环while print('How many guests will you have?') numOfGuests = int(input())#输入的值(必须为数字),把它转为整型数值 if numOfGuests:#若输入了0以外的值【true】则执行下一步打印,否则跳过下一句 print('Be sure to have enough room for all your guests.') print('Done')
转载于:https://www.cnblogs.com/chenxi188/p/10524024.html
原文链接:https://blog.csdn.net/weixin_30342827/article/details/98918691
本站声明:网站内容来源于网络,如有侵权,请联系我们,我们将及时处理。
还没有人抢沙发呢~