How to remove a specific item from a set in Python

1 Answer

0 votes
st = {'python', 'java', 'c', 'c++', 'c#'}
 
st.remove('java')
print(st)

# st.remove('xyz') # KeyError: 'xyz'





'''
run:

{'c', 'python', 'c++', 'c#'}

'''

 



answered Aug 10, 2022 by avibootz
...