I have the following Python code :
currentPlayers = query.getPlayers()
for player in currentPlayers:
return str(player[\'name\'])+\" \"+str(playe
players is a list which needs to be indexed by integers. You seem to be using it like a dictionary. Maybe you could use unpacking -- Something like:
name, score = player
(if the player list is always a constant length).
There's not much more advice we can give you without knowing what query is and how it works.
It's worth pointing out that the entire code you posted doesn't make a whole lot of sense. There's an IndentationError on the second line. Also, your function is looping over some iterable, but unconditionally returning during the first iteration which isn't usually what you actually want to do.