第3章-10 统计大写辅音字母 (15分)【python】

英文辅音字母是除A、E、I、O、U以外的字母。本题要求编写程序,统计给定字符串中大写辅音字母的个数。

输入格式:
输入在一行中给出一个不超过80个字符、并以回车结束的字符串。

输出格式:
输出在一行中给出字符串中大写辅音字母的个数。

输入样例:
HELLO World!

      
    
输出样例:
4

      
    
作者: C课程组
单位: 浙江大学
时间限制: 400 ms
内存限制: 64 MB

str = input()
str1 = "AEIOU"
count = 0
for ch in str:
    if(ch != 'A' and ch != 'I' and ch != 'O' and ch != 'U' and ch != 'E' and ch>='A' and ch<='Z'):
        count+=1
print(count)
exit(0)
发布了363 篇原创文章 · 获赞 95 · 访问量 18万+

猜你喜欢

转载自blog.csdn.net/qq_43788669/article/details/105395135
今日推荐