变量为空代表false
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')