menu
In Python, if you want to access the index while iterating over a sequence (like a list), you can use the built-in function enumerate().
Here’s how you can do it:
xs = [8, 23, 45]
for index, x in enumerate(xs):
    print(f"item #{index + 1} = {x}")

This will give you the desired output:
item #1 = 8
item #2 = 23
item #3 = 45