If you don't need to give a variety of variable names, use a dictionary structure that dynamically assigns keys and links values to each key.
a = {}
k = 0
while k < 10:
<dynamically create key>
key = ...
<calculate value>
value = ...
a[key] = value
k += 1
You can also use the 'collections' module to find some data structures to solve your questions :
http://docs.python.org/dev/library/collections.html
© 2024 OneMinuteCode. All rights reserved.