๐ Python Basics
Working with Strings
Slice, format, and transform text.
Strings are sequences of characters. You can index them with [i], slice with [a:b], and call methods on them.
s = "Python"
print(s[0]) # P
print(s[-1]) # n
print(s[1:4]) # yth
print(s.upper()) # PYTHON
f-strings let you embed expressions directly: f"length = {len(s)}".