I'm an absolute beginner.
Is there a function to search inside a set?
If not, does anyone have a function that does so? (set to search in, value to search for)
I'm an absolute beginner.
Is there a function to search inside a set?
If not, does anyone have a function that does so? (set to search in, value to search for)
In essence this would be the search of a 'subset' in a set:
# search for a subset in a set (Python3 syntax)
set1 = {'red','green','blue','black','orange','white'}
set2 = {'black', 'green'}
print('These are the colors common to set1 and set2:')
print(set1 & set2)
"""my result ==>
{'green', 'black'}
"""
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.