Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

add in python

prime_numbers = {2, 3, 5, 7}

# add 11 to prime_numbers
prime_numbers.add(11)


print(prime_numbers)

#if the element is already in the set, it won't add it

# Output: {2, 3, 5, 7, 11}
Source by www.programiz.com #
 
PREVIOUS NEXT
Tagged: #add #python
ADD COMMENT
Topic
Name
7+8 =