Welcome to Lesson 8! Let's master strings β text data. Manipulate, slice, and format them!
Strings are just text in quotes:
name = "Alex"Get parts of strings:
word = "Python"
print(word[0]) # 'P'
print(word[2:5]) # 'tho'Useful tools:
.upper(),.lower(),.title(),.replace(),.find(),.split()
msg = "hello world"
print(msg.upper())Combine with variables:
name = "Alex"
age = 15
print(f"My name is {name} and I'm {age}")