# Return two things at once
# multiple return values — pack and unpack

# ─────────────────────────────────────────────
# Your first multiple return
# ─────────────────────────────────────────────

def first_and_last(word):
    return word[0], word[-1]

first, last = first_and_last("RedHorn")
print(first)    # R
print(last)     # n

# two values returned — two variables to receive them

# ─────────────────────────────────────────────
# BMI with category
# ─────────────────────────────────────────────

def calculate_bmi(weight, height):
    bmi = weight / height ** 2
    if bmi < 18.5:
        category = "Underweight"
    elif bmi < 25:
        category = "Normal weight"
    elif bmi < 30:
        category = "Overweight"
    else:
        category = "Obese"
    return bmi, category

bmi, category = calculate_bmi(70, 1.75)
print(f"BMI: {bmi:.1f} — {category}")    # BMI: 22.9 — Normal weight

# one function — two pieces of information — one call

# ─────────────────────────────────────────────
# Ignoring one of the values
# ─────────────────────────────────────────────

bmi, category = calculate_bmi(70, 1.75)
print(category)    # Normal weight — use only what you need

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

# return a, b          — returns two values at once
# x, y = function()   — unpacks them into two variables
# order matters        — first return value goes to first variable
# number of variables must match number of return values
