Skip to content

Count the vowels · ⁨数元音字母⁩

English

Count the vowels

Count how many characters of a string are vowels — a, e, i, o, u — treating capitals and lowercase the same.

Lowercase the string first with s.lower() so you only have five letters to check. The expression ch in "aeiou" is True when ch is one of them.

中文

数元音字母

数一数字符串中有多少个字符是元音 —— a、e、i、o、u —— 大写和小写视为相同。

先用 s.lower() 把字符串转成小写,这样只需检查五个字母。表达式 ch in "aeiou" 在 ch 是其中之一时为 True。

Log in or create account · ⁨登录或创建账户⁩

IGCSE, A-Level · ⁨IGCSE、A-Level⁩ & AP · ⁨与 AP⁩