Previous

While Loops

1 / 4
Next

A while loop allows code to be repeated as long as a Boolean condition is true.

count = 1
while count <= 5:
  print(f"Loop {count}")
  count = count + 1
print("Done!")

This loop continues until count exceeds 5. The indentation determines the body of the while loop.

Send

Simple while loops

Hint
Beginner

Input an integer n. Make a string s that contains exactly n numbers of stars and print s.

For example, if n is 3, then s should be ***.

Help
Solve
Reset
Run
Submit
 

Test results

Test result #
Expected output
Your output

Your email has been verified!