Следите за новинками
в нашем Telegram канале. Жми, чтобы подписаться:)
⊗pyPmLpWI 161 of 208 menu
◀ ▶

If condition in while loop in Python

In the while loop, you can also use the if condition and the break statement.

Let's divide the number 10.5 by 2 until the result is less than one:

num = 10.5 while True: num = num / 2 if num < 1: break print(num) # 0.65625

You are given a number. Divide it by 2 as many times as necessary until the result is less than 10. What number do you get?

Given an integer, get a list of divisors of this number.

← →
↑
English▼
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline