Below code is printing all variable names, how can I print variable values instead?
a1 = 10
a2 = 20
a3 = 30
a4 = 40
a5 = 50
for i in range(5):
print(f"a{i}")
I want to access variable names in the program using format specifiers. Any help is appreciated, thanks in advance.
New contributor
Max is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.