【发布时间】:2020-04-13 23:13:16
【问题描述】:
Question = input("Welcome to the meal chooser program. The base cost is $9.99. Would you like to choose beef, chicken, or the vegetarian option?:")
if Question.casefold() == "beef":
print("Thank you. Your total cost is","$",'{:.2f}'.format(B))
elif Question.casefold() == "chicken":
print("Thank you. Your total cost is","$", '{:.2f}'.format(C))
elif Question.casefold() == "vegetarian":
print("Thank you. Your total cost is","$", '{:.2f}'.format(V))
B = 9.99*1.02
C = 9.99*1.025
V = 9.99*1.03
每当我运行此程序并输入鸡肉、牛肉或素食时,它都会提示我一条消息,说明 B、C 和 V 的值未定义,但它们是。
【问题讨论】:
-
您的标题表明程序没有运行,但您收到一条消息说什么? (是哪一个?)
标签: python python-3.x nameerror