You can check if an element is present in a set in Python using the in keyword. The in keyword returns True if the element is present in the set, and False otherwise.
Here's an example:
my_set = {1, 2, 3, 4, 5}
if 3 in my_set:
print("3 is present in the set")
else:
print("3 is not present in the set")
Output:
3 is present in the set
You can also use the not in keyword to check if an element is not present in the set.
Here's an example:
my_set = {1, 2, 3, 4, 5}
if 6 not in my_set:
print("6 is not present in the set")
else:
print("6 is present in the set")
Output:
6 is not present in the set
Note that the in and not in keywords work with all types of sets, including sets of strings, sets of tuples, etc.