I've looked around at other posts on here for a solution to my problem but none of them seems to work for me. I want to append a tuple to (what starts out as) an empty list. I've checked my code and it looks like whenever I try to just append my tuple it turns the list into a NoneType object. Here's what I've got:
list_of_pairs = []
for player in standings:
opponent = standings[standings.index(player) + 1]
matchup = (player[0:2] + opponent[0:2])
list_of_pairs = list_of_pairs.append(matchup)
print "ADDED TO LIST: " + str(list_of_pairs)
Each player
in the standings list contains a tuple with four elements. I've tried using index and re-assigning list_of_pairs = [list_of_pairs, matchup]
, but nothing seems to be returning the right thing (i.e. [(player),(next player), (another player), (etc.)]
. Every time I print "added to list" I just get ADDED TO LIST: None
. I've checked matchup
as well and it's definitely storing the first two values of the respective players fine. Any ideas?