bill = 0
if size == "S":
bill += 10
if size == "M":
bill += 15
if size == "L":
bill += 20
if Pepperoni == "Yes" and size == "S":
if Pepperoni == "Yes" and size == "M" or size == "L":
bill += 2
if extra_cheese == "Yes":
bill += 1
print(f"Your final bill is ${bill}")
欢迎光临python比萨外卖!您想要多大的比萨?S,M还是L?M您想要意大利辣香肠吗?是或否?是的您想要额外的奶酪吗?是或否?是的您的最终账单是16美元
你的短信?
2条答案
按热度按时间bfrts1fy1#
第二个
if
条件永远不可能为真,因为它只在我们已经知道size为“S”时才执行。ddrv8njm2#