Python_Institute
PCEP-30-02 · Question #289
PCEP-30-02 Question #289: Real Exam Question with Answer & Explanation
Sign in or unlock PCEP-30-02 to reveal the answer and full explanation for question #289. The question stem and answer options stay visible for context.
Question
The ABC organiza a company needs a simple program that their call center will use to enter survey data for a new coffee variety. The program must accept input and return the average rating based on a five-star scale. The output must be rounded to two decimal places. You need to complete the code to meet the requirements. What should you insert instead of XXX, YYY and ZZZ?
1 sum = count = 0
2 average = 0.0
3
4 while rating != -1:
5 rating = XXX
6 if rating == -1:
7 break
8 sum += rating
9 count += 1
10
11 average = float(sum / count)
12
13 YYY + ZZZ
Options
- AXXX -> float(input('Enter next rating (1-5), -1 for done')) YYY -> print('The average star rating for the new coffee is: ' ZZZ -> format(average, '.2f'))
- BXXX -> input('Enter next rating (1-5), -1 for done') YYY -> print('The average star rating for the new coffee is: ' ZZZ -> format(average, '.2f'))
- CXXX -> float(input('Enter next rating (1-5), -1 for done')) YYY -> print('The average star rating for the new coffee is: ' ZZZ -> format(average, '.2f'))
- DXXX -> input('Enter next rating (1-5), -1 for done') YYY -> print('The average star rating for the new coffee is: ' ZZZ -> format(average, '.2f'))
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.