EN
Python - iterate through string
0 points
In this article, we would like to show you how to iterate through a string in Python.
Quick solution:
xxxxxxxxxx
1
for x in "dirask":
2
print(x)
In this example, we use for
loop to iterate through the "dirask"
string and print each character.
xxxxxxxxxx
1
for x in "dirask":
2
print(x)
Output:
xxxxxxxxxx
1
d
2
i
3
r
4
a
5
s
6
k