Python_Institute
PCEP-30-02 · Question #248
PCEP-30-02 Question #248: Real Exam Question with Answer & Explanation
The correct answer is C. 1|%-20s 2|%4.1f. See the full explanation below for the reasoning.
Question
The ABC Company is building a basketball court for its employees to improve company morale. You are creating a Python program that employees can use to keep track of their average score. The program must allow users to enter their name and current scores. The program will output the user name and the user's average score. The output must meet the following requirements:
- The user name must be left-aligned.
- If the user name has fewer than 20 characters, additional space must be added to the right.
- The average score must have three places to the left of the decimal point and one place to the right of the decimal (xxx.x). What would you insert instead of ??? and ??? ?
Options
- A1 |%-20f 2|%4.1s
- B1|%-20f 2|%4.1
- C1|%-20s 2|%4.1f
- D1|%-20f 2|%1.4s
Community Discussion
No community discussion yet for this question.