nerdexam
Python_Institute

PCEP-30-02 · Question #321

PCEP-30-02 Question #321: Real Exam Question with Answer & Explanation

Sign in or unlock PCEP-30-02 to reveal the answer and full explanation for question #321. The question stem and answer options stay visible for context.

Question

Consider the following code. nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] x = 0 while x < 10: print(nums(x)) # Line 4 if nums[x] == 7: # Line 5 break else: x += 1 You want to print the numbers 1 to 7 to the monitor. But the code does not work. What do you have to change? (Choose two.)

Options

  • Ax = x + 1 # Line 8
  • Bwhile (x < 10): # Line 3
  • Cprint(nums[x]) # Line 4
  • Dif nums[x] == 7: # Line 5

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.

Full PCEP-30-02 Practice