qobjects = [
{
question: "Which operator does __contains__() control?",
options: [
"in",
"==",
"+"
],
correct: 0
},
{
question: "What must __contains__() return?",
options: [
"A list",
"A number",
"A boolean (True or False)"
],
correct: 2
},
{
question: "What will this code print?class Company:",
options: [
"True",
"False",
"Error"
],
correct: 0
}
]
def __init__(self, employees):
self.employees = employees
def __contains__(self, name):
return name in self.employees
c1 = Company(['Emil', 'Tobias'])
print('Tobias' in c1)