Page 256 - CITS - CSA - TP (Volume 2) - Hindi
P. 256
कं ूटर सॉ वेयर ए ीके शन - CITS
print(“You scored grade B+...”)
elif marks > 40 and marks <= 60:
# If the condition is true, we will enter this block
print(“You scored grade B...”)
elif marks > 30 and marks <= 40:
# If the condition is true, we will enter this block
print(“You scored grade C...”)
else:
# If none of the above conditions are true, we will enter this block
print(“Sorry, you have failed.”)
ीकरण:
• marks = int(input(“Enter the marks? “)): अंकों के िलए उपयोगकता इनपुट लेता है और उसे पूणा क म प रवित त करता है।
• ‘marks’ के मू के आधार पर िविभ ितयों की जांच करने के िलए if-elif-else कथन का उपयोग करने वाला कोड।
• शत को उनके कट होने के म म जांचा जाता है, और पहली स शत ( कं डीशन) के ॉक को िन ािदत िकया जाता है।
• यिद अंक 85 से अिधक और 100 से कम या बराबर ह , तो यह ि ंट करता है “Congrats! आपने ेड ए ोर िकया है...”
• यिद नहीं, तो यह अगले elif पर चला जाता है और जाँचता है िक ा अंक 60 से अिधक और 85 से कम या बराबर ह ।
• यह ि या अ elif ितयों के िलए जारी रहती है।
• यिद कोई भी शत स नहीं है, तो else ॉक िन ािदत होता है, और यह ि ंट करता है िक “Sorry, you have failed”
आउटपुट :
टा 5: मैच के स
कोड :
num=int(input(“Enter the Number: “))
defdescribe_number(num):
matchnum:
case 0:
return “Zero”
242
CITS : IT & ITES - कं ूटर सॉ वेयर अनु योग - अ ास 125

