Let's say I have
myString = "ORANGE"
How can I write a for-each loop that lists each character so it looks like this
1O
2R
3A
4N
5G
6E
I am confused as I don't know how to do it without using range.
Let's say I have
myString = "ORANGE"
How can I write a for-each loop that lists each character so it looks like this
1O
2R
3A
4N
5G
6E
I am confused as I don't know how to do it without using range.
for index, character in enumerate('ORANGE'):
print('{}{}'.format(index + 1, character))
Python docs on enumerate