how to iterate over string in python code example
Example 1: how to loop through string in python
for i in "Hello":
print(i)
Example 2: iterate through characters in a string python
for c in "string":
#do something with c
Example 3: iterating string in python
"""
Python Program:
Using slice [] operator to iterate over a string partially
"""
string_to_iterate = "Python Data Science"
for char in string_to_iterate[0 : 6 : 1]:
print(char)