21. What will be the output of the following Python code?
def f(x):
yield x+1
print("test")
yield x+2
g=f(9)
def f(x):
yield x+1
print("test")
yield x+2
g=f(9)
22. What happens when '1' == 1 is executed?
23. Which of the following is not a standard exception in Python?
24. Is the following Python code valid?
try:
# Do something
except:
# Do something
finally:
# Do something
try:
# Do something
except:
# Do something
finally:
# Do something
25. What is the purpose of the except clause without specifying an exception type in a try block?
26. What is the purpose of the else clause in a try block?
27. Identify the type of error in the following Python codes?
Print(“Good Morning”)
print(“Good night)
Print(“Good Morning”)
print(“Good night)
28. Which of the following is not a standard Python exception?
29. What is the purpose of the sys.exc_info() function in Python?
30. What will be the output of the following Python code?
g = (i for i in range(5))
type(g)
g = (i for i in range(5))
type(g)