Skip to main content
← CoursesPython FoundationsModule 1 · Fundamentals of syntaxStringswrite4 / 170
💬 Discuss🧪 Playground+75 XP
Task
📝 Task: Write a greeting() function 📋 What to do: 1. Create a function greeting(name) that takes a name 2. Inside, return the string "Hi, {name}!" 3. Use an f-string: f"Hi, {name}!" 4. Call greeting("Anna") via print() — should output: Hi, Anna! 💡 Template: def greeting(name): return f"Hi, {name}!" print(greeting("Anna")) 💡 What's an f-string: f"..." lets you insert variables into text: age = 25 print(f"I am {age} years old") # I am 25 years old ⚠️ The word "Hi" is Russian — keep it as test data.

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…