Python_Institute
PCEP-30-02 · Question #335
PCEP-30-02 Question #335: Real Exam Question with Answer & Explanation
Sign in or unlock PCEP-30-02 to reveal the answer and full explanation for question #335. The question stem and answer options stay visible for context.
Question
The ABC company needs a way to find the count of particular letters in their publications to ensure that there is a good balance. It seems that there have been complaints about overuse of the letter e. You need to create a function to meet the requirements.
Consider the following code:
Function accepts a list of words from a file,
and a letter to search for.
Returns count of the words containing that letter.
def count_letter(letter, word_list): count = 0 for ???: if ???: count += 1 return count word_list = []word_list is populated from a file. Code not shown.
letter = input('Which letter would you like to count?') letter_count = count_letter(letter, word_list) print('There are', letter_count, 'words with the letter', letter) What would you insert instead of ??? and ??? ?Options
- Aword in word_list word in letter
- Bword_list in word letter in word
- Cword in word_list letter in word
- Di in word_list letter in i
- Ei in word_list word in letter
- Fword in word_list 2 letter is word
Unlock PCEP-30-02 to see the answer
You've previewed enough free PCEP-30-02 questions. Unlock PCEP-30-02 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.