7-2 餐馆订位 :编写一个程序,询问用户有多少人用餐。如果超过8人,就打印一条消息,指出没有空桌;否则指出有空桌。
number=input("How many people? Please:")
num=int(number)
if num>8:
print("Sorry, There is no empty table.")
else:
print("We have empty table")
7-3 10的整数倍 :让用户输入一个数字,并指出这个数字是否是10的整数倍。
number=input("Please input a number:")
num=int(number)
if num%10==0:
print("This number is an integer multiple of 10.")
else:
print("This number is not an integer multiple of 10.")
7-4 比萨配料 :编写一个循环,提示用户输入一系列的比萨配料,并在用户输入'quit' 时结束循环。每当用户输入一种配料后,都打印一条消息,说我们会在比萨中添加这种配料。
while True:
st=input("Please input an ingredient:");
if (st=='quit'):
break
print("We will add &