Python does not support a character type; these are treated as strings of length one, thos also considered a substring.
To access substrings, use the square brackets for slicing along with the index or indices to obtain your substring.
Example:
var1= “Hello World”
print (“var1[0]:”, var1[0])
When the above code is executed, it produces:
var1[0]: H
Gilberto Rogel García
For more info visit:This link
#mastery26
#TC1014
#mastery26 Creation and use of strings in Python by Gilberto Rogel García is licensed under a Creative Commons Attribution 4.0 International License.