我在想count_letters = count_vowels + count_consonants
答案 0 :(得分:1)
def count_vowels(string):
#count vowels
return number_vowels
def count_consonants(string):
#count consonants
return number_consonants
def count_letters(string):
return count_consonants(string) + count_vowels(string)
但是你知道有更简单的方法来计算一个字符串中的字母数,对吗?
您可能希望查看该问题How to count the number of letters in a string without the spaces?以获得有用的答案。