Python_Institute
PCEP-30-02 · Question #289
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…
The correct answer is A. XXX -> 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')). See the full explanation below for the reasoning.
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'))
How the community answered
(31 responses)- A71% (22)
- B16% (5)
- C3% (1)
- D10% (3)
Community Discussion
No community discussion yet for this question.