Lesson 8 of 34

if / else: ನಿರ್ಧರಿಸುವ ಪ್ರೋಗ್ರಾಮ್‌ಗಳು

8 min 25 XP

if ಎಂದರೆ “ಇದು true ಆದರೆ ಇದನ್ನು ಮಾಡು”. 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 ಎಂದರೆ “ಇಲ್ಲದಿದ್ದರೆ”. Condition 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.