Page 255 - CITS - CSA - TP (Volume 2) - Hindi
P. 255
कं ूटर सॉ वेयर ए ीके शन - CITS
ीकरण:
• a = int(input(“Enter a: “)): थम सं ा ‘a’ के िलए उपयोगकता इनपुट लेता है और उसे पूणा क म प रवित त करता है।
• b = int(input(“Enter b: “)): दू सरे नंबर ‘b’ के िलए उपयोगकता इनपुट लेता है और इसे पूणा क म प रवित त करता है।
• c = int(input(“Enter c: “)): तीसरे नंबर ‘c’ के िलए उपयोगकता इनपुट लेता है और इसे पूणा क म प रवित त करता है।
• कोड ‘a’, ‘b’, और ‘c’ म से कौन सी सं ा सबसे बड़ी है, यह जांचने के िलए if कथनों की एक ृंखला का उपयोग करता है।
• if a > b and a > c:: जाँचता है िक ा ‘a’, ‘b’ और ‘c’ दोनों से बड़ा है।
• print(“From the above three numbers, given ‘a’ is the largest”): यिद ‘a’ सबसे बड़ा है तो मैसेज ि ंट करता है।
• इसी कार के if कथन और मैसेज ‘b’ और ‘c’ के िलए मौजूद ह ।
आउटपुट:
टा 4: elif कथन को समझने के िलए पायथन ो ाम
कोड:
# Simple Python program to understand the elif statement
# Taking an integer input for marks dynamically
marks = int(input(“Enter the marks? “))
# Checking various conditions using if-elif-else statements
if marks > 85 and marks <= 100:
# If the condition is true, we will enter this block
print(“Congrats! You scored grade A...”)
elif marks > 60 and marks <= 85:
# If the condition is true, we will enter this block
241
CITS : IT & ITES - कं ूटर सॉ वेयर अनु योग - अ ास 125

