Skip to content

Count vowels

Python how many vowels

Flowchart (ISO 5807)

YesNoStartInput scount = 0ch ∈ sch ∈ «aeiouAEIOU»count = count + 1Return countEndFigure 1 — count_vowels

Source code

Python
def count_vowels(s):
    count = 0
    for ch in s:
        if ch in "aeiouAEIOU":
            count += 1
    return count

The editor opens with this code — change it and the chart redraws.

Language
Python
Constructs
how many vowels
Topic
Loops
Formats
Word, Visio, draw.io, PDF, SVG

Related examples