相关疑难解决方法(0)

在String Python中计算元音

我正在尝试计算字符串中特定字符的出现次数,但输出错误.

这是我的代码:

inputString = str(input("Please type a sentence: "))
a = "a"
A = "A"
e = "e"
E = "E"
i = "i"
I = "I"
o = "o"
O = "O"
u = "u"
U = "U"
acount = 0
ecount = 0
icount = 0
ocount = 0
ucount = 0

if A or a in stri :
     acount = acount + 1

if E or e in stri :
     ecount = ecount + 1

if I …
Run Code Online (Sandbox Code Playgroud)

python

13
推荐指数
8
解决办法
11万
查看次数

标签 统计

python ×1