0

I'm trying to print out a list using a following code:

list_1 = [1,2,3]
list_2 = [1,2,3,4]
list_3 = [1,2,3,7,9]
list_4 = [1,2,7,11,12,15]

for x in range(1,5):
    print(f'list_{x}')

print(list_1)

which outputs the following:

list_1
list_2
list_3
list_4
[1, 2, 3]

I would like the first f'string list_1 to out put the list as in the final output.

Is there a string type that I need to convert my f'string into first or something else?

Jason
  • 35
  • 4

1 Answers1

0

Just did some further investigation - it seems I needed to convert my string to a class and it now does the trick!

Convert string to Python class object?

Jason
  • 35
  • 4