Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python for character in string

# Python program to iterate over characters of a string
  
# Code #1
string_name = "geeksforgeeks"
  
# Iterate over the string
for element in string_name:
    print(element, end=' ')
print("
")
  
  
# Code #2
string_name = "GEEKS"
  
# Iterate over index
for element in range(0, len(string_name)):
    print(string_name[element])
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #python #character #string
ADD COMMENT
Topic
Name
4+2 =