Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.
exam questions

Exam PCEP-30-02 All Questions

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

Exam PCEP-30-02 topic 1 question 36 discussion

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

What is the expected output of the following code?

  • A. ('Peter', 'Peter',)
  • B. PeterPeter
  • C. The code is erroneous.
  • D. ('Peter')
  • E. ()
Show Suggested Answer Hide Answer
Suggested Answer: E 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
LunaMeadows1
2 months, 3 weeks ago
Selected Answer: E
E is the correct answer. Breakdown of data = ('Peter',) * (len(nums) - nums[::-1][0]) len(nums) = 3 nums[::-1] reverses the list so nums would become [3,2,1] nums[0] would then return 3 as the first element When multiplying a tuple, you create that many versions of the current entry. 3-3 becomes 0 and multiplying anything by 0 becomes 0 so there would be 0 entries in the tuple returning ()
upvoted 2 times
...
christostz03
3 months ago
e is the correct answer
upvoted 2 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 ...