Python Hisses

Tick the valid output of the code written below:

numberOfLoops = 0

numberOfApples = 2

while numberOfLoops < 10:

numberOfApples *= 2

numberOfApples += numberOfLoops

numberOfLoops -= 1

print("Number of apples: " + str(numberOfApples))

Number of apples: 4 Infinite Loop

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

1 solution

The while loop will never break the condition given. So you will have to press Ctrl+C to put an end to this looping.

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...