高级编程技术第七次作业

7-3 10的整数倍

num = input("Please input a number: ")
num = int(num)
if num % 10 == 0:
	print('It is an integer multiple of 10')
else:
	print('It is not an integer multiple of 10')

7-6 三个出口

prompt = '\nPlease tell me some ingredients, I will add them to the pizza.'
prompt += "\nEnter 'quit' to end the program. "
ingredient = ""
while ingredient != 'quit':
	ingredient = input(prompt)
	if ingredient != 'quit':
		print('We add ' + ingredient + ' to the pizza.')
prompt = '\nPlease tell me some ingredients, I will add them to the pizza.'
prompt += "\nEnter 'quit' to end the program. "
active = True
while active:
	ingredient = input(prompt)
	if ingredient != 'quit':
		print('We add ' + ingredient + ' to the pizza.')
	else:
		active = False
prompt = '\nPlease tell me some ingredients, I will add them to the pizza.'
prompt += "\nEnter 'quit' to end the program. "
while True:
	ingredient = input(prompt)
	if ingredient != 'quit':
		print('We add ' + ingredient + ' to the pizza.')
	else:
		break

7-9 五香烟熏牛肉

sandwich_orders = ['pastrami', 'pastrami', 'pastrami', 'tuna', 'chicken breast']
print('Pastrami has been sold out.')
while 'pastrami' in sandwich_orders:
	sandwich_orders.remove('pastrami')
print(sandwich_orders)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值