Starlit Daily

📚 › Python: the friendliest first language

9. while loops

इस लेख का अनुवाद अपने आप होगा। अभी अंग्रेज़ी में दिखाया जा रहा है।

A while loop repeats as long as its condition is True. Change the variable inside the loop, or the loop never stops.

Use while when you do not know in advance how many times to repeat.

उदाहरण देखें

count = 1
while count <= 3:
    print(count)
    count += 1

✍️ अब आपकी बारी

Use a while loop to print 2, 4, 6 on separate lines, starting with n = 2.

← कोर्स पर वापस