Lesson 14 of 34

break, continue

8 min 30 XP

break മുഴുവൻ loop-ഉം ഉടൻ നിർത്തുന്നു. continue ഈ round-ന്റെ ബാക്കി ഒഴിവാക്കി അടുത്തതിലേക്ക് പോകുന്നു.

Example: edit me and press Run

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

Example: edit me and press Run

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

while True എന്നാൽ break വരുന്നതുവരെ “എന്നും തുടരൂ”. ഉപയോക്താവ് “stop” ടൈപ്പ് ചെയ്യുന്നതുവരെ input വായിക്കാൻ ഇത് ഉപകാരപ്രദമാണ്.

Example: edit me and press Run

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

Challenge

+30 XP

input() ഉപയോഗിച്ച് സംഖ്യകൾ ഓരോന്നായി വായിക്കൂ. 0 കിട്ടുമ്പോൾ നിർത്തൂ (break). നെഗറ്റീവ് സംഖ്യകൾ ഒഴിവാക്കൂ (continue), അവസാനം പോസിറ്റീവ് സംഖ്യകളുടെ മാത്രം തുക print ചെയ്യൂ.

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