我正在为我的计算机编程原理介绍课程做最后的项目,我采用了一个旧项目来从列表中查找项目价格并将其转换为显示 NFL 团队的最终分数。
我的第一个有效代码:
#Start Program
foundItemFlag = False
itemNum = (34, 124, 178, 219, 225)
price = (3.76, 1.29, 4.78, 2.76, 4.51)
input = int(input("Enter the Item Number: "))
for k in range (5):
if input == itemNum[k]:
foundItemFlag = True
print("The item number you've chosen is ", input, "and the price is ", price[k])
if (foundItemFlag == False):
print("Invalid Item Number!")
#End Program
这是我正在尝试修复的转换后的代码..
#Start Program
foundTeamFlag = False
teamName = ("Bills", "Dolphins", "Patriots", "Jets", "Ravens", "Bengals", "Browns", "Steelers", "Texans", "Colts", "Jaguars", "Titans", "Broncos", "Chiefs", "Raiders", "Chargers")
final = (6-10, 7-9, "12-4", "6-10", "10-6", "10-6", "5-11", "8-8", "12-4", "11-5", "2-14", "6-10", "13-3", "2-14", "4-12", "7-9")
input = int(input("To find your team's final record for last season please type in their name (Ravens, Texans and etc) :"))
for k in range (5):
if input == teamName[k]:
foundTeamFlag = True
print("The ", input, "final record for 2012-2013 was ", final[k])
if (foundTeamFlag == False):
print("Oops, check your team name and try again!")
#End Program
我是一个初学者,将我的代码复制到 IDLE 并收到 NFL 代码的此错误:
SyntaxError: multiple statements found while compiling a single statement