Chrome Extension

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)
Code faster with devsheet chrome extension and increase productivity as a programmer
search code from your favorite search engine instantly.
Install Now
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?
0 Comments
Open Code Manager We are hiring