Skip to main content

Gil

I suck at programming.
I'm not a good student.

#mastery26 Creation and use of strings in Python

1 min read

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