Help
Contact
For teachers and institutes
Search courses, problems, tests…
A
A
>_
StemPy Lab
Courses ▾
Problems ▾
Practice ▾
Mock Tests
Classes
Groups
Community ▾
A
A
A class has __lt__ but no __eq__. Which call works? | StemPy Lab
Quizzes
/
A class has __lt__ but no __eq__. Which call works?
Python Programming
Easy
High School (11–12)
High School (9–10)
Undergraduate
General
Python Going Further › Inheritance and Special Methods
Created by
StemPy Lab
A class has __lt__ but no __eq__. Which call works?
obj1 == obj2 comparing the values
obj1 + obj2
sorted(list_of_objects)
len(obj1)
Check Answer
Log in to save
Tag someone
⚑ Report
← All Quizzes
← class S: def __len__(self): return 4. What does print(len(S())) show?
class A: def __init__(self): self.v = 1. class B(A): def __init__(self): super().__init__(). self.w = 2. What does print(B().v + B().w) show? →
More on
Python Going Further › Inheritance and Special Methods
Discussion (0)
Log in
to join the discussion.
Loading…
Problems on this topic
For each pair, say whether you would use inheritance (is a) or composition (has a), and why.
Easy
A class Note has an attribute rupees. Write __lt__ and __str__ so that sorted puts a list of notes…
Medium
For each line of code, name the special method that Python calls.
Easy
The loop below works for any animal. Add a class Bird that says Tweet, and a class Parrot built on…
Medium
All problems on this topic →