number = input("输入一个数字:")
number = int(number)
ifnumber % 10 == 0:
print("这是10的整数倍")
else:
print("这不是10的整数倍")
7-5 电影票:
msg = "请输入你的年龄,我会告诉你对应的电影票价,或者输入'quiz'退出:"
age = input(msg)
while age != 'quiz':
age = int(age)
if age < 3:
print("免费")
elif age <= 12:
print("10美元")
else:
print("15美元")
age = input(msg)
7-7 死循环:
whileTrue:
print("hello world")
7-8 熟食店:
sandwich_orders = ['potato', 'tomato', 'banana']
finished_sandwiches = []
while sandwich_orders:
sandwich = sandwich_orders.pop();
print("I made your " + sandwich + " sandwich.")
finished_sandwiches.append(sandwich)
for sandwich in finished_sandwiches:
print("The " + sandwich + " sandwich is finished.")