python – Replacing elements in a sheet by their index starting from 1 and not 0

Question:

There is a leaf

list_1 = ['a', 'b', 'c']

Values ​​should be replaced like this

list_1 = ['element_1', 'element_2', 'element_3']

Starting from 1 and not 0

I tried to do it like this

list_1 = ['element_{}'.format(i) for i in range(i+1, len(list_1))]

or so

list_1 = ['element_{}'.format(i) for i in range(1, len(list_1))]

But if there is an element in sheet 1, an empty sheet is returned

list_2 = ['a']

Answer:

Choice:

list_1 = ['element_{}'.format(i+1) for i in range(len(list_1))]
list_1 = ['element_{}'.format(i) for i in range(1, len(list_1)+1)]
Scroll to Top