I am trying to create loop in Python to call different variables.
example0="result1"
example1="result2"
example2="result3"
example3="result4"
example4="result5"
for i in range(5):
print(example+(i))
The result I expect will be
result1
result2
result3
result4
result5
I have tried several solutions, the furthest I got is with :
for i in range(5):
locals()["example"+str(i)]()
but I recieve error
" locals()["example"+str(i)]()
TypeError: 'str' object is not callable