def main(n):
print(n)
def countVowels(): #统计函数
vowels = "aeiouAEIOU"
count = 0
string = input("请输入一个字符串:")
for i in string: #循环遍历
if i in vowels:
count += 1 #计数
return count #返回统计结果
main(countVowels())
此处放出核心函数代码,这个函数代码是可以通过输入字符串来进行统计的,在理解了这个基础上,题主可以尝试改一下,通过读文件信息来统计元音字母。
望采纳!!