Answers for "remove an item from a set python"

4

remove an item from a set python

# it doesn't raise error if element doesn't exits in set

thisset = {1, 2,3}

thisset.discard(3)

print(thisset)
Posted by: Guest on May-17-2020
6

remove element form set in python

list1 = {1,2,3,4}
list1.remove(4)
print(list)
# {1,2,3}
Posted by: Guest on May-17-2020
2

remove an item from a set python

list.discard(item)
Posted by: Guest on May-17-2020

Code answers related to "remove an item from a set python"

Python Answers by Framework

Browse Popular Code Answers by Language