1.

What do you understand by traversing a string ? 

Answer»

Traversing a string means accessing all the elements of the string one after the other by using the subscript. A string can be traversed using for loop or while loop. 

For example :

A = ‘Python’

i = 0

while i < lenn (A) :

print A[i] 

i = i + 1

Output : 

P

t

n



Discussion

No Comment Found