Python For Looping Through a String


Looping Through a String

Even strings are iterable objects, they contain a sequence of characters:

Example

Loop through the letters in the word "banana":

for x in "banana":
  print(x)
Try it Yourself »


Copyright 1999-2023 by Refsnes Data. All Rights Reserved.