in operator means, with __contains__.
class Vocab:
def __init__(self, words):
self.words = [w.lower() for w in words]
def __contains__(self, w):
return w.lower() in self.words
v = Vocab(["Apple", "kiwi"])
Which of these give True? Choose every correct option.One or more options are correct. Tick all the correct ones: a wrong option costs marks, and a part-right answer earns part of the marks.
Log in to join the discussion.
Loading…