python iterate on str code example
Example 1: iterating string in python
"""
Python Program:
Using range() to iterate over a string in Python
"""
string_to_iterate = "Data Science"
for char_index in range(len(string_to_iterate)):
print(string_to_iterate[char_index])
Example 2: python iterate over string
word = "test"
for letter in word:
print(letter)