exam questions

Exam PCEP-30-02 All Questions

View all questions & answers for the PCEP-30-02 exam

Exam PCEP-30-02 topic 6 question 292 discussion

Actual exam question from Python Institute's PCEP-30-02
Question #: 3
Topic #: 6
[All PCEP-30-02 Questions]

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 ??? ?

  • A. 1 | %-20f
    2 | %4.1s
  • B. 1 | %-20i
    2 | %4.1
  • C. 1 | %-20s
    2 | %4.1f
  • D. 1 | %-20f
    2 | %1.4s
  • E. 1 | %-20d
    2 | %4.1f
  • F. 1 | %-20s
    2 | %1.4f
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
Donny_575
2 weeks, 5 days ago
Selected Answer: C
C. 1 | %-20s 2 | %4.1f Explanation: >> Format: %-20s '%' starts the format specifier '-' left-aligns the text '20' reserves 20 character spaces 's' formats as a string >> Format: %4.1f '4' is the minimum width '.1' controls the decimal places 'f' formats as a float
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago