python

Loop through string characters in Python

You can simply apply python for loop on a string that will gives you the character of the string in each iteration.

for char in "orange":
    print(char)
Output
o
r
a
n
g
e

Here we are applying a for loop on the string 'orange' that will print each character of the string as output.

Was this helpful?