# Loop and decide — together
# for + if in nested loops — filter at every level

# ─────────────────────────────────────────────
# if in the outer loop
# ─────────────────────────────────────────────

word = "RedHorn"
vowels = "aeiou"

for letter in word:
    if letter.lower() in vowels:
        print(f"{letter} — vowel")

# e — vowel
# o — vowel

# ─────────────────────────────────────────────
# if in the inner loop
# ─────────────────────────────────────────────

words = "red horn bull".split()
target = "o"

for word in words:
    for letter in word:
        if letter == target:
            print(f"Found '{target}' in '{word}'")

# Found 'o' in 'horn'

# ─────────────────────────────────────────────
# if at both levels
# ─────────────────────────────────────────────

words = "red horn bull".split()
vowels = "aeiou"

for word in words:
    if len(word) > 3:              # outer filter — word length
        for letter in word:
            if letter in vowels:   # inner filter — vowel check
                print(f"{word} — vowel found: {letter}")

# horn — vowel found: o

# ─────────────────────────────────────────────
# break inside a nested loop
# ─────────────────────────────────────────────

words = "red horn bull".split()
target = "o"

for word in words:
    for letter in word:
        if letter == target:
            print(f"Found '{target}' in '{word}'")
            break    # stops the inner loop only — outer keeps going

# ─────────────────────────────────────────────
# Quick reference
# ─────────────────────────────────────────────

# if can go at any level — outer, inner, or both
# break stops the current loop only — not the one above
# each level adds 4 spaces — track your indentation
# two levels of nesting is usually the limit
