Lesson 13 of 34

while Loops: నిజమైనంత వరకు పునరావృతం

8 min 25 XP

ఎన్నిసార్లు పునరావృతం చేయాలో ముందే తెలియనప్పుడు while వాడండి. షరతు True గా ఉన్నంత వరకు loop నడుస్తూనే ఉంటుంది.

Example: edit me and press Run

Output Loading Python (first time takes a few seconds)
Press Run to see the result here.

count = count + 1 రాయడం మర్చిపోతే loop ఎప్పటికీ ముగియదు (infinite loop). అలా జరిగితే Stop నొక్కండి.

ఉదాహరణ: ₹1000 పొదుపు నెలకు 10% పెరిగితే, ₹2000 కావడానికి ఎన్ని నెలలు పడుతుంది?

Example: edit me and press Run

Output Loading Python (first time takes a few seconds)
Press Run to see the result here.

months += 1 అంటే months = months + 1 కి సంక్షిప్త రూపం.

Challenge

+25 XP

while loop తో 5 నుండి 1 వరకు వెనక్కి లెక్కించండి, ప్రతి సంఖ్య వేరే లైన్‌లో. తర్వాత Go! print చేయండి.

Output Loading Python (first time takes a few seconds)
Press Run to see the result here.