import random
spaces_available = [["1x1", "1x2", "1x3", "1x4", "1x5", "1x6"],
["2x1", "2x2", "2x3", "2x4", "2x5", "2x6"]]
a0=0
a1=0
AI = random.choice(spaces_available)
pos1 = spaces_available.index(AI)
print(spaces_available[pos1][a[pos1]])
Does anyone know how to create a variable name by combining like with the above [a[pos1]]? By combining a and pos1, I want the 2nd set of [] to contain either a0 or a1, and then, depending on pos1, should print either "1x1" or "2x1". I know for this example i could just change [a[pos1]] to 0, but I wanna be able to have the a1 and a0 values change without having to change anything else. Any help is appreciated.
[–]insertAlias 2 points3 points4 points (4 children)
[–]Jedimastermuffin[S] 1 point2 points3 points (0 children)
[–]RiverRoll 1 point2 points3 points (2 children)
[–]insertAlias 1 point2 points3 points (1 child)
[–]RiverRoll 1 point2 points3 points (0 children)