top of page

Strings in Python

Updated: Apr 19, 2023

A string value is also treated as an array in Python. The elements inside each string can be accessed using index numbers.





a = "Wow Champs!"
print(a)
#A string is an array
print(a[0])
print(a[-1])

#slicing
print(a[5:8])


#slice from start
print(a[:3])

#slice from end
print(a[1:])

The link to the Github repository is here .

Subscribe to get all the updates

© 2025 Metric Coders. All Rights Reserved

bottom of page