How do i convert an index to an integer?

I tried int(index), that didnt work.

For example;

S = [a,b,c,d]

For index in S:
    n = int(index)
    print (n)

print ()

If I understand, you need to loop over an array of String while taking note of the index?

Either you need another integer variable you increase at each loop, or you can leverage enumerate library function.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .