English

Predict the output of the Python code given below: def Diff(N1,N2): if N1>N2: return N1-N2 else: return N2-N1 NUM= [10,23,14,54,32] for CNT in range (4,0,-1): A=NUM[CNT] B=NUM[CNT-1] print - Computer Science (Python)

Advertisements
Advertisements

Question

Predict the output of the Python code given below:

def Diff(N1,N2):
 if N1>N2:
 return N1-N2
 else:
 return N2-N1

NUM= [10,23,14,54,32]
for CNT in range (4,0,-1):
 A=NUM[CNT]
 B=NUM[CNT-1]
 print(Diff(A,B),'#', end=' ')
One Line Answer

Solution

22 # 40 # 9 # 13 #

shaalaa.com
Handling Exceptions
  Is there an error in this question or solution?
2022-2023 (March) Sample
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×