# COMMON STRING MISTAKES
# Each block shows the wrong way, the error it produces, and the right way
# Read through — don't just run it top to bottom

# ─────────────────────────────────────────────
# MISTAKE 1 — Forgetting to close a quote
# ─────────────────────────────────────────────

# Wrong — SyntaxError
# name = "Bull

# Right
name = "Bull"

# ─────────────────────────────────────────────
# MISTAKE 2 — Mixing quote types
# ─────────────────────────────────────────────

# Wrong — SyntaxError
# name = "Bull'

# Right
name = "Bull"
# or
name = 'Bull'

# ─────────────────────────────────────────────
# MISTAKE 3 — Indexing starts at 0, not 1
# ─────────────────────────────────────────────

name = "Bull"

print(name[1])   # u — not B, because indexing starts at 0
print(name[0])   # B — this is the first character

# ─────────────────────────────────────────────
# MISTAKE 4 — Index out of range
# ─────────────────────────────────────────────

name = "Bull"   # indexes: 0, 1, 2, 3

# Wrong — IndexError
# print(name[4])

# Right — check length first if unsure
print(len(name))   # 4
print(name[3])     # l — last character

# ─────────────────────────────────────────────
# MISTAKE 5 — Thinking methods change the original
# ─────────────────────────────────────────────

name = "bull"
name.upper()

print(name)        # bull — unchanged, method returned a new string

name = name.upper()
print(name)        # BULL — reassigned, now it works

# ─────────────────────────────────────────────
# MISTAKE 6 — Adding a string and a number
# ─────────────────────────────────────────────

age = 25

# Wrong — TypeError
# print("I am " + age)

# Right — convert to string first
print("I am " + str(age))   # I am 25

# Or use an f-string — cleaner
print(f"I am {age}")         # I am 25

# ─────────────────────────────────────────────
# MISTAKE 7 — Case sensitivity in comparisons
# ─────────────────────────────────────────────

name = "Bull"

print("bull" in name)          # False — case sensitive
print("Bull" in name)          # True

# Normalize before comparing
print("bull" in name.lower())  # True — safe approach
