Skip to main content
← CoursesPython FoundationsModule 1 · Fundamentals of syntaxNumbers and mathematicswrite5 / 170
💬 Discuss🧪 Playground+75 XP
Task
📝 Task: Circle area 📋 What to do: 1. Import the math module (has π) 2. Create function circle_area(r) that returns area 3. Formula: S = π × r² 4. Call with radius 5, wrap in round(..., 2) 💡 Template: import math def circle_area(r): return math.pi * r ** 2 print(round(circle_area(5), 2)) # Expected: 78.54 💡 What's new: • math.pi — the number π ≈ 3.14159 • r ** 2 — squaring (r²) • round(x, 2) — round to 2 decimal places

Keep going

✏️ Write your code here
🐍
Loading Python...
First visit only — ~5-10s. Stays cached afterward.
📊 Result
Press Run to see result...
📣 Help someone learn PythonShare this lesson with a friend — the first 15 are free, no signup.Tweet

💬 Discussion

Be the first to ask a question or share a tip.
Sign in to join the discussion. Reading is free.
Loading discussion…