I have a number of arrays: player1 = [data, data, data] player2 = [data, data, data] player3 = [data, data, data] player4 = [data, data, data]
I want to be able to do something like: count = 2 if player + count[3] == 5: do this do that count += 1 And that would do this and that to the array 'player2' in slot 3. It adds 1 to 'count', so next time through it will access the array 'player3'. Basically I want to be able to integrate the value of one variable into another variables name. It's hard explain, hopefully the code above will give you an idea of what I'm trying to achieve. Alternately, how can I use the return of a function as a variables name? eg: def choose_player(player): if player == 1: return player1[3 if player == 2: return player2[3] if player == 3: return player3[3] if player == 4: return player4[3] choose_player(2) = 5 This was another way I thought of doing it - one that might actually work - but it comes back with "Can't assign to function call." I'm not trying to assign it to the function itself, but the outcome of the function. I can use it to read the value of the player2 variable (ie. if choose_player(2) == 5), but not set it. Once again, I hope I've given an idea of what I'm trying to do. Any way I can achieve this? _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor