提问人:Osman Abuna 提问时间:8/21/2023 最后编辑:Bill HilemanOsman Abuna 更新时间:8/21/2023 访问量:60
CS50 EOF 的 PSET3 输入停止程序 Felipes Taqueria [关闭]
CS50 PSET3 input of EOF halts program Felipes Taqueria [closed]
问:
因此,当看到代码运行和输出所需的所有步骤时,我的代码有点正确,但是在检查时我得到了错误input of EOF halts program
这是我的代码
d = {
"Baja Taco": 4.00,
"Burrito": 7.50,
"Bowl": 8.50,
"Nachos": 11.00,
"Quesadilla": 8.50,
"Super Burrito": 8.50,
"Super Quesadilla": 9.50,
"Taco": 3.00,
"Tortilla Salad": 8.00
}
food_total = 0.00
while True:
x = input("Item: ").title()
if x in d:
food_total += d[x]
print("Total: $", food_total, sep="")
else:
print(end="")
我什至尝试将代码更改为
d = {
"Baja Taco": 4.00,
"Burrito": 7.50,
"Bowl": 8.50,
"Nachos": 11.00,
"Quesadilla": 8.50,
"Super Burrito": 8.50,
"Super Quesadilla": 9.50,
"Taco": 3.00,
"Tortilla Salad": 8.00
}
food_total = 0.00
while True:
try:
x = input("Item: ").title()
if x in d:
food_total += d[x]
print("Total: $", food_total, sep="")
else:
print(end="")
except EOFError:
pass
但没有任何区别
答: 暂无答案
评论