1# Iterate through a string using a for loop
2name="Nagendra"
3for letter in name:
4 print(letter)
5
6# Iterate through a string using a for loop
7index = 0
8while index<len(name):
9 print(index)
10 index += 1
11#Iterate through a list of strings using a for loop
12list_names = ['Nagendra','Nitesh','Sathya']
13for name in list_names:
14 print(name)
15
16#Iterate through a string using a while loop
17list_names = ['Nagendra','Nitesh','Sathya']
18index = 0
19while index<len(list_names):
20 print(list_names[i])
21 index += 1
22