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 4 · Object-oriented programmingWord count in the textscenario63 / 174
+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`
✏️ 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…