Skip to main content
← CoursesPython FoundationsModule 3 · Functions and stringsNumber of vowelswrite35 / 170
💬 Discuss🧪 Playground+100 XP
Task
📝 **Task:** `count_vowels(text)` counts English vowels (a, e, i, o, u). 📋 **Steps:** 1. `def count_vowels(text):` 2. `count = 0` 3. For each char in `text`: if it's a vowel, `count += 1` 4. Return `count` 💡 **Similar example (count digits):** ```python def count_digits(text): return sum(1 for ch in text if ch in "0123456789") print(count_digits("abc123def45")) # 5 ``` 🎯 **Expected output:** `2`

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…