Which Of The Following Python Code Will Print Truep Pre #1059
Which of the following Python code will print True?</p> <pre><code class="language-python">a = foo(2) b = foo(3) print(a < b)</code></pre>
This multiple choice question (MCQ) is related to the book/course gs gs109 Python. It can also be found in gs gs109 Classes and Objects - Python Operator Overloading - Quiz No.1.
Which of the following Python code will print True?
a = foo(2) b = foo(3) print(a < b)
class foo: def __init__(self, x): self.x = x def __lt__(self, other): if self.x < other.x: return False else: return True
class foo: def __init__(self, x): self.x = x def __less__(self, other): if self.x > other.x: return False else: return True
class foo: def __init__(self, x): self.x = x def __lt__(self, other): if self.x < other.x: return True else: return False
class foo: def __init__(self, x): self.x = x def __less__(self, other): if self.x < other.x: return False else: return True