Skip to main content
🔒 Preview mode. The first 15 Foundations lessons are free; this one is Pro. Start a 7-day trial to unlock the editor, AI hints and the rest of the curriculum. Card required, cancel any time in Dashboard.Start 7-day trial →
← CoursesPython FoundationsModule 2 · Data structuresWelcome functionwrite18 / 174
+75 XP
Task
📝 **Task:** Greeting function with two parameters. 📋 **Steps:** 1. Define `def greet(name, time_of_day):` 2. Use `if/elif/else` to check `time_of_day`: - "morning" → return `"Good morning, {name}!"` - "afternoon" → return `"Good afternoon, {name}!"` - "evening" → return `"Good evening, {name}!"` 3. Call `greet("Ivan", "morning")` and print it 💡 **Similar example (BMI):** ```python def bmi(weight, height): return round(weight / (height ** 2), 1) print(bmi(70, 1.75)) # 22.9 ``` ⚠️ **Hint:** use an f-string: `f"Good morning, {name}!"`. 🎯 **Expected output:** `Good morning, Ivan!`
✏️ Write your code here
🐍
Loading Python...
One-time download (~1 MB). Then it runs instantly.
📊 Result
Press Run to see result...

💬 Discussion

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