QuestionQ84

VerifiedControl Flow – Conditional Blocks and Loops

You are creating a Python application for an online product-distribution company. The program must iterate through a product list and exit when it finds a target product ID.

Question Image

What should be inserted in place of ??? and ????

Explanation

A while statement repeatedly executes while index < 10 is true. break terminates the nearest enclosing loop as soon as the target product ID, 6, is encountered; otherwise, index += 1 advances to the next list item.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!