I am trying to create a list that holds dictionaries of randomly generated colors. So for instance, the first dictionary of the list would be color 0 with values of 255, 255, 255. I am getting a syntax error with the "color{x}" where python is saying that it should be an integer or a splice, but not a string. Removing the color part gives me another error where python is saying the set object has no format attribute.
This is using pygame 1.9.4 and python 3.7 and I am rather new to python programming in general. I have tried messing with the "color{x}" part, but this previous thread had something similar that work for them, so I just copied the syntax to see if I could get it to work.
colors = []
colorLength = len(colors)
for x in range(3):
colors["color{x}".format(x)]= random.randint(0,255),
random.randint(0,255), random.randint(0,255)
#colors.append()
else:
print(colorLength)
I am trying to get the list colors to hold 3 dictionaries (at the moment, plan on expanding the list when I get it working), that hold a randomly generated color.