Which of the following is not a built-in function in python.
What will be the output of the following Python code?
def unpack(a,b,c,d):
print(a+d)
x = [1,2,3,4]
unpack(*x)
What is the output of the following Python code?
import random
print(random.randint(0,9))
Using a comma as a separator in print statements, you can combine:
Predict the output of the following code:
a = [1, 2, 10, 300, 500]
a[2] = 3
print(a)
Which of the following Python regular expression functions returns a tuple containing the (start, end) positions of the match?
When is the value of the module attribute, __name__
, equal to 'main'?
What is the output of the following code?
def function(lst, x, s, e):
a = lst.index(x, s, e)
return a
lst = [1, 2, 2, 3, 5, 6, 1, 2, 2, 2, 3, 4, 5, 2, 8, 9]
print(function(lst, 2, 5, 14))
print(function(lst, 1, 0, 8))
Which of the following statements is wrong about inheritance?
class A:
def __init__(self):
self.calcI(30)
print("i from A is", self.i)
def calcI(self, i):
self.i = 2 * i;
class B(A):
def __init__(self):
super().__init__()
def calcI(self, i):
self.i = 3 * i;
b = B()