range(0, 3)
returns a list like this:
[0, 1, 2]
If you want this to become [a0, a1, a2], you could use list comprehension.
eg.
myList = ["a" + str(val) for val in range(0, 3)]
If you have not used lists, then this is just a concise way of writing
myList = []
for val in range(0, 3):
myList.append("a" + str(val))
After that myList will be
['a0', 'a1', 'a2']
source
share