Lesson 8 of 34

if / else: முடிவெடுக்கும் program

8 min 25 XP

if என்பது “இது உண்மையானால் இதைச் செய்” என்று சொல்வது. if வரியின் கடைசியில் : (colon) வேண்டும். அதன் கீழ் உள்ள வரிகள் 4 spaces உள்ளே தள்ளி (indent) இருக்க வேண்டும்.

Example: edit me and press Run

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

else என்பது “இல்லையென்றால்”. நிபந்தனை False ஆனால் else பகுதி இயங்கும். marks-ஐ 20 என மாற்றி Run செய்து பாருங்கள்.

Example: edit me and press Run

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

பயனர் தரும் மதிப்பின் அடிப்படையிலும் முடிவெடுக்கலாம். Input பெட்டியில் வேறு வயதை எழுதி Run செய்யுங்கள்.

Example: edit me and press Run

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

Indentation-ஐ வைத்துதான் Python எந்த வரிகள் if-க்குள் உள்ளன என்று புரிந்துகொள்கிறது. Tab பொத்தானைப் பயன்படுத்துங்கள்.

Challenge

+25 XP

ஒரு எண்ணை input() மூலம் பெறுங்கள். அது இரட்டைப்படை என்றால் Even என்றும், இல்லையெனில் Odd என்றும் print செய்யுங்கள்.

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