HelpContactFor teachers and institutes
>_StemPy Lab
Mock TestsClasses

>_StemPy Lab

Learn. Solve. Code the solutions. Test yourself.

Live examsFree mock exams, timed and rankedEveryone starts together, and your score and rank come the moment it ends.See the exams →

Learn

  • Physics
  • Chemistry
  • Mathematics
  • Biology
  • Python Programming
  • Statistics & Data Science
  • Classes
  • Groups

Practice

  • Problems
  • Quizzes
  • Mock Tests
  • Prepare for an Exam
  • Question Sets
  • Exams
  • Certificates
  • Python Labs
  • AI Practice Generator
  • Student-Created Tests

Community

  • Discussions
  • Resources
  • Notes
  • Glossary
  • Blog

Account

  • Log in
© 2026 senLearn. All rights reserved.HelpAboutContactPrivacy PolicyTerms of UseRefund Policy
  1. Glossary
  2. /Python and data
  3. /While Loop (Repeat Until)

What is While Loop (Repeat Until)?

In short

A while loop repeats a block of code as long as a condition is true. Python has no "repeat until" command, so you write while not condition to repeat until something happens.

In simple words

The condition is checked before each repeat. If it is false at the start, the block never runs. Make sure something inside the loop changes the condition, otherwise the loop never ends. To repeat until a condition is true, test the opposite with while not done:, or use while True: with break when the condition is met.

Example

This prints 11: money at 7%7\%7% interest doubles after about 111111 years.

Also searched as: repeat until in python, python repeat until, repeat until, python until.

Learn it properly

  • Lessons on this topic
  • Test yourself

Related terms

  • For Loop
  • Variable (in Python)

← All glossary terms

Learn it in

  1. Repeat with for: Loops
  2. Repeat Until: while Loops
All lessons on this topic →

Practise

  1. This loop should show the even numbers from 2 up to and including 10…Medium
  2. Write a program that asks for a password, again and again, until the user types python123…Medium
  3. Find the first number from 100 upwards that can be divided by both 6 and 8…Easy
Asha saves 45 rupees every week, and has 0 at the start…Easy

Quick questions

  1. A for loop prints its numbers with no space and no new line between them. The sequence…Hard
  2. A while loop takes numbers from the end of a list until it meets a zero. What does the…Hard
  3. A loop uses pass and a statement after the if and else blocks. What does the program…Hard

More Python and data terms

  1. Cell (in a Python notebook)
  2. Class and Special Methods (in Python)
  3. Dictionary (in Python)
  4. Function (in Python)
  5. If Statement (in Python)
  6. Import (Python modules and libraries)
All Python and data terms →

Try it yourself

Python labs run in your browser. Type the code, run it and see what happens.

Open a Python lab