Lesson 9 of 34

elif: दो से ज़्यादा विकल्प

8 min 25 XP

जब दो से ज़्यादा विकल्प हों, तो elif (else if) का उपयोग करें। Python ऊपर से नीचे जाँचता है और सिर्फ़ पहला True हिस्सा चलाता है।

Example: edit me and press Run

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

क्रम मायने रखता है! सबसे बड़ी सीमा (>= 35) पहले रखें, नहीं तो 40 पर भी “Warm” छपेगा।

यह दुकान की छूट का उदाहरण है। Input box में अलग-अलग राशि डालकर देखें।

Example: edit me and press Run

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

Challenge

+25 XP

input() से marks पढ़ें और grade print करें: 90 या उससे ज़्यादा → A 75 या उससे ज़्यादा → B 50 या उससे ज़्यादा → C बाक़ी सब → Fail

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