Q.
Compare the following two Python codes shown below and state the output if the input entered in each case is -6?
CODE 1
import math
num=int(input("Enter a number of whose factorial you want to find"))
print(math.factorial(num))
CODE 2
num=int(input("Enter a number of whose factorial you want to find"))
print(math.factorial(num)) Similar Questions
1.
How many except statements can a try-except block have?
2.
When will the else part of try-except-else be executed?
3.
Is the following Python code valid?
try:
# Do something
except:
# Do something
finally:
# Do something 4.
Is the following Python code valid?
try:
# Do something
except:
# Do something
else:
# Do something 5.
Can one block of except statements handle multiple exception?
6.
When is the finally block executed?
7.
What will be the output of the following Python code?
def foo():
try:
return 1
finally:
return 2
k = foo()
print(k) 8.
What will be the output of the following Python code?
def foo():
try:
print(1)
finally:
print(2)
foo() 9.
What will be the output of the following Python code?
try:
if '1' != 1:
raise "someError"
else:
print("someError has not occurred")
except "someError":
print ("someError has occurred") 10.
What happens when ‘1’ == 1 is executed?
PYTHON TOPICS