Page 263 - CITS - CSA - TP (Volume 2) - Hindi
P. 263
कं ूटर सॉ वेयर ए ीके शन - CITS
टा 4 : अ रों के साथ समकोण पैटन
कोड :
print(“The character pattern using the ascii value is: “)
asciiValue = 65 # here, we are giving the ASCII value of A
foriin range(0, 5): # here, we are declaring the for loop for I values
for j in range(0, i + 1): # here, we are declaring the for loop for j values
# Here, the below will convert the ASCII value to the character
alphabate = chr(asciiValue)
print(alphabate, end=’ ‘) # Here, we are printing the alphabets
asciiValue += 1
# Here, we are incrementing the asciivalue by 1 after each iteration
print()
ीकरण:
• बाहरी लूप (for i in range(0, 5)) पैटन म लाइन की सं ा को िनयंि त करता है (इस मामले म 5 लाइन)।
• आंत रक लूप (for j in range(0, i + 1)) ेक रो म वण की सं ा को िनयंि त करता है, और यह बाहरी लूप के ेक पुनरावृि के साथ बढ़ता
है।
• chr(asciiValue) वत मान ASCII मान को संगत वण म प रवित त करता है।
• print(alphabet, and=’ ‘) अगली पं पर जाए िबना वण को ि ंट करता है।
• asciiValue += 1 अनु म म अगले वण के िलए ASCII मान बढ़ाता है।
• print() पैटन म अगली पं के िलए अगली रो पर चला जाता है।
आउटपुट:
249
CITS : IT & ITES - कं ूटर सॉ वेयर अनु योग - अ ास 126

