String Operations - Working with Text

Strings are sequences of characters (letters, numbers, symbols). You can: 1) Combine strings with +, 2) Repeat strings with *, 3) Get length with len(), 4) Access specific letters (called indexing), 5) Use .upper() to make all caps, .lower() for lowercase.

# String operations
first_name = "John"
last_name = "Doe"

# Combining strings (concatenation)
full_name = first_name + " " + last_name
print("Full name:", full_name)

# Repeating strings
laugh = "ha"
laugh_3_times = laugh * 3
print("Laughter:", laugh_3_times)

# String methods
greeting = "hello world"
print("Uppercase:", greeting.upper())
print("Capitalized:", greeting.title())

# String length
password = "mypassword123"
print("Password length:", len(password), "characters")