Introduction to Programming using Python 1st Edition

Published by Pearson
ISBN 10: 0132747189
ISBN 13: 978-0-13274-718-9

Chapter 5 - Loops - Section 5.2 - The while Loop - Check Point - MyProgrammingLab - Page 142: 5.2

Answer

While loop in line 7 is skipped when variable number is set to 0.

Work Step by Step

If guess variable is initialized to 0 in line 8 in Listing 5.3 then in the case random integer number generated in line 3 is equal to 0 the while loop condition guess != number is False and the user doesn't get the chance to guess the random number generated.
Update this answer!

You can help us out by revising, improving and updating this answer.

Update this answer

After you claim an answer you’ll have 24 hours to send in a draft. An editor will review the submission and either publish your submission or provide feedback.