Lesson 8 of 34

if / else: నిర్ణయించే ప్రోగ్రామ్‌లు

8 min 25 XP

if అంటే “ఇది నిజమైతే, ఇది చేయి”. if లైన్ : (colon) తో ముగుస్తుంది, దాని కింది లైన్లు 4 spaces లోపలికి ఉంటాయి.

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 box లో వేరే వయసు పెట్టి Run నొక్కండి.

Example: edit me and press Run

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

ఏ లైన్లు if లోపల ఉన్నాయో Python indentation ద్వారా గుర్తిస్తుంది. Tab key వాడండి.

Challenge

+25 XP

input() తో ఒక సంఖ్య చదవండి. సరి సంఖ్య అయితే Even, కాకపోతే Odd print చేయండి.

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