問題セットに取り組んでいます-これがQです:
2 つの関数定義が同じファイルに保存されます。関数 count_vowels には 1 つのパラメーター (単語) があり、その単語の母音の数を返します。関数 count_consonants は 1 つのパラメーター (単語) を持ち、その単語の子音の数を返します。単語の文字数を決定するには、count_vowels と count_consonants の両方を呼び出す次の関数の 1 行の本文を記述します。
def count_letters(word):
""" (str) -> int
Return the number of letters in word.
>>> count_letters('hello')
5
>>> count_letters('bonjour')
7
"""
# Write the one-line function body that belongs here.
私の答え:
return count_letters(count_vowels() + count_consonants())
違う。なんで?