Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Iterate string 2 characters at a time in python

mystring = "Hello Oraask"

# Getting length of string 
lengthOfmystring = len(mystring)

# Iterating through the string using while loop 
for i in mystring[0:lengthOfmystring:2] : 
# Print all characters iterated
    print("Element of string:" , i)
Source by www.oraask.com #
 
PREVIOUS NEXT
Tagged: #Iterate #string #characters #time #python
ADD COMMENT
Topic
Name
7+8 =