Jul-11-2021, 09:58 AM
(Jul-11-2021, 08:35 AM)quest Wrote: How can I do that?
Figuring out solution and writing code.
Lot of ambiguity in problem description, but there is data structure in Python called sets which primary purpose is:
Quote:A set is an unordered collection with no duplicate elements. Basic uses include membership testing and eliminating duplicate entries. Set objects also support mathematical operations like union, intersection, difference, and symmetric difference.
So one can write something like that:
>>> names = ['spam', 'ham', 'eggs', 'bacon'] >>> pairs = [['ham', 'bacon'], ['spam', 'foo']] >>> for pair in pairs: ... print(set(pair).issubset(names)) ... True False
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.