Lesson 13 of 34

while Loops: True ആയിരിക്കുമ്പോൾ ആവർത്തിക്കൂ

8 min 25 XP

എത്ര തവണ ആവർത്തിക്കണമെന്ന് മുൻകൂട്ടി അറിയില്ലെങ്കിൽ while ഉപയോഗിക്കൂ. Condition 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 വരെ പിന്നോട്ട് എണ്ണി, ഓരോ സംഖ്യയും സ്വന്തം വരിയിൽ print ചെയ്യൂ. പിന്നെ Go! print ചെയ്യൂ.

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