PRACTICE

While Loops

Lesson notes

Your task

Start n at 1 and double it while it is below 50. Print n after the loop finishes.

Expected output
64
Loading…

OUTPUT

Worked solution
n = 1
while n < 50:
    n *= 2
print(n)

Checks compare printed output, not your approach. Several solutions can be valid.

← Back to courses