Skip to main content
← CoursesPython FoundationsModule 4 · Object-oriented programmingWord count in the textscenario60 / 170
💬 Discuss🧪 Playground+100 XP
Task
📝 **Task:** Count how many times `"apple"` appears in `text = "apple banana apple orange banana apple"`. 📋 Use `text.split().count("apple")`. 💡 **Similar example:** ```python text = "cat dog cat fish cat bird" words = text.split() print(words.count("cat")) # 3 ``` 🎯 **Expected output:** `3`

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…