Python Challenge Solution

Anthony Dibaya
Anthony Dibaya
8,700 Points

My code won't run correctly.

After asking if user would like to add players to the list it prints the number of players in the list which is 0. Then asks to pick a goalkeeper than says

Traceback (most recent call last):
File "team.py", line 34, in <module>
print("The keeper will be {}.".format(player[keeper-1]))
NameError: name 'player' is not defined

Any suggestions?

1 Answer

KRIS NIKOLAISEN
KRIS NIKOLAISEN
54,333 Points

A little difficult to tell without seeing the rest of your code. Should player be players here?

print("The keeper will be {}.".format(player[keeper-1]))