qobjects = [
{
question: "Which operator does __lt__() control?",
options: [
"==",
"<",
"+"
],
correct: 1
},
{
question: "Besides the < operator, what else can use __lt__()?",
options: [
"print()",
"sorted()",
"len()"
],
correct: 1
},
{
question: "What will this code print?class Person:",
options: [
"True",
"False",
"Error"
],
correct: 1
}
]
def __init__(self, age):
self.age = age
def __lt__(self, other):
return self.age < other.age
p1 = Person(22)
p2 = Person(19)
print(p1 < p2)