Advertisements
Advertisements
प्रश्न
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=' ')Advertisements
उत्तर
22 # 40 # 9 # 13 #
APPEARS IN
संबंधित प्रश्न
How many except statements can a try-except block have?
When will the else part of try-except-else be executed?
Can one block of except statements handle multiple exceptions?
Which of the following blocks lets you test a block of code for errors?
Which of the following is true for Exceptions:
- Exceptions disrupt normal flow of the program
- It is common for exceptions to show up before the program is executed
- Runtime errors are known as Exceptions
- Exception is a Python object that represents an error
What is not true for exception handling?
In exception handling, what keeps track of exact position where error has occurred?
Define the following:
Exception Handling
Define the following:
Throwing an exception
Define the following:
Catching an exception
Explain catching exceptions using try and except block.
You have learnt how to use math module in Class XI. Write a code where you use the wrong number of arguments for a method (say sqrt() or pow()). Use the exception handling process to catch the ValueError exception.
“In a Python program, if a break statement is given in a nested loop, it terminates the execution of all loops in one go.”
