# Format your output like Picasso
# f-strings accept format specs after : inside {}

# ─────────────────────────────────────────────
# Formatting floats
# ─────────────────────────────────────────────

price = 3.14159265

print(price)              # 3.14159265 — raw, too many decimals
print(f"{price:.2f}")     # 3.14 — 2 decimal places
print(f"{price:.4f}")     # 3.1416 — 4 decimal places
print(f"{price:.0f}")     # 3 — no decimals

# ─────────────────────────────────────────────
# Formatting integers
# ─────────────────────────────────────────────

score = 1000000

print(f"{score}")         # 1000000 — hard to read
print(f"{score:,}")       # 1,000,000 — thousands separator
print(f"{score:10}")      # right-aligned in 10 characters
print(f"{score:<10}")     # left-aligned in 10 characters

# ─────────────────────────────────────────────
# Combining numbers and text
# ─────────────────────────────────────────────

name = "Bull"
score = 1547.891
rank = 3

print(f"Player: {name:<10} | Score: {score:>10.2f} | Rank: #{rank}")
# Player: Bull       | Score:    1547.89 | Rank: #3

# ─────────────────────────────────────────────
# Padding and alignment — clean tables
# ─────────────────────────────────────────────

print(f"{'Name':<10} {'Score':>10}")
print(f"{'Bull':<10} {1547.89:>10.2f}")
print(f"{'Horn':<10} {983.45:>10.2f}")
print(f"{'Red':<10} {2341.00:>10.2f}")

# Output:
# Name            Score
# Bull          1547.89
# Horn           983.45
# Red           2341.00

# ─────────────────────────────────────────────
# Percentage formatting
# ─────────────────────────────────────────────

ratio = 0.857

print(f"{ratio:.0%}")    # 86%
print(f"{ratio:.1%}")    # 85.7%
print(f"{ratio:.2%}")    # 85.70%

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

value = 1234.5678

print(f"{value:.2f}")    # 1234.57  — float, 2 decimals
print(f"{value:,.2f}")   # 1,234.57 — thousands separator + 2 decimals
print(f"{value:>15.2f}") #        1234.57 — right-aligned in 15 chars
print(f"{value:<15.2f}") # 1234.57         — left-aligned in 15 chars
print(f"{0.1234:.1%}")   # 12.3%    — percentage, 1 decimal
