Lesson 14 of 34

break மற்றும் continue

8 min 30 XP

break: loop-ஐ உடனே முழுவதுமாக நிறுத்தும். continue: இந்தச் சுற்றின் மீதியைத் தவிர்த்து, அடுத்த சுற்றுக்குச் செல்லும்.

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 வரும் வரை loop ஓடும். பயனர் “stop” என்று எழுதும் வரை வார்த்தைகளைப் பெற இது உதவும்.

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). எதிர்மறை (negative) எண்களைத் தவிர்த்து (continue), நேர்மறை எண்களின் கூட்டுத்தொகையை மட்டும் கடைசியில் print செய்யுங்கள்.

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