The quiz where the difficulty automagically adapts to the player's Python knowledge
This is a question page. You can use this page to bookmark a question. Start a new quiz!
Question #191
class Test1 (object):
pass
class Test2 (Test1):
pass
a = Test1()
b = Test2()
print(type(b) is Test1)
False! Even if the class Test2 inherits from the class Test1 , running the function type() on an instance of Test2 will not detect it. (geeksforgeeks.org/python-type-function)
What is the output of the code snippet below?
— The Python Quiz (@thepythonquiz) October 20, 2020
class Test1 (object):
pass
class Test2 (Test1):
pass
a = Test1()
b = Test2()
print(type(b) is Test1)
False
True#python #python3 #pythonprogramming #learnpython
Question difficulty: π΅π΅π΅π΅π΅