python中的2d列表if语句不起作用

时间:2018-01-26 13:42:29

标签: python-3.x

我正在尝试在python中创建一个2D列表,它允许您搜索英超联赛中前五名球队的胜利,平局和失利数量。到目前为止,我有:

league = [["20","14","14","12","11"],["2","5","4","8","5"],
["0","3","4","2","5"]]
team = input("Do you want to know Manchester City, Machester United, 
Chelsea, Liverpool or Tottenham Hotspur").lower
if team == "manchester city":
    teamNum = 0
elif team == "manchester united":
    teamNum = 1
elif team == "chelsea":
    teamNum = 2
elif team == "liverpool":
    teamNum = 3
elif team == "tottenham hotspur":
    teamNum = 4

winDrawLoss = input("Do you want to know wins, draws or losses?").lower
if winDrawLoss == "wins":
    print(league[0][teamNum])
elif winDrawLoss == "draws":
    print(league[1][teamNum])
elif winDrawLoss == "losses":
    print(league[2][teamNum])

但我的if语句不起作用。任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:0)

当您指定了团队时,键入的是lower而不是lower()