How to correctly iterate and count vowels in a Python string?
I am trying to complete a Python assignment that involves counting the vowels in a given string (for example, `"hello world"` should result in `3`), and then printing the total count at the end. When I run my code, it gives a `TypeError: 'int' object is not iterable` on the `for` loop, and I am also confused about how to properly check each character and print the final `count`. Since I am a beginner, I am not looking for a one-liner solution (like a list comprehension). Instead, I want to understand how to fix my `for` loop and `if` logic step-by-step—specifically what the loop should iterate
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.