python iterate through letters 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: python string iterate 3 characters at a time

start #position of character in string to start at, 0 indexed
stop #position of character in string to stop at, 0 indexed
iteration #number of characters to iterate over, e.g. 2, 3, 4, etc.
for character in string[start:stop:iteration]
	#do funky magik thang hur

Tags:

Java Example