QuestionQ190

VerifiedControl Flow – Conditional Blocks and Loops

What occurs when the user executes the following code?

Question Image

Explanation

The initial value of speed is 3, which does not satisfy speed < 0, so the while loop body is skipped. A while loop’s else block runs when the loop finishes without encountering break, and it prints one asterisk.

Community Discussion

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