- Create a set named
rose_gardencontaining different types of roses:"red rose","white rose","yellow rose". Print the same. - Add
"pink rose"to therose_gardenset. Print the set to confirm the addition. - Remove
"yellow rose"from therose_gardenset using theremove()method. Print the set to verify the removal. - Create another set
botanical_gardenwith elements"sunflower","tulip", and"red rose". Find the union ofrose_gardenandbotanical_gardenand print the result. - Find the intersection of
rose_gardenandbotanical_gardenand print the common elements. - Find the difference between
rose_gardenandbotanical_gardenand print the elements that are only inrose_garden. - Find the symmetric difference between
rose_gardenandbotanical_gardenand print the elements unique to each set. - Create a set
small_gardencontaining"red rose","white rose". Check ifsmall_gardenis a subset ofrose_gardenand print the result. - Check if
rose_gardenis a superset ofsmall_gardenand print the result. - Use the
len()function to find the number of elements in therose_gardenset. Print the result. - Use the
discard()method to remove"pink rose"from therose_gardenset. Try to discard a non-existent element"blue rose"and observe what happens. - Use the
clear()method to remove all elements from therose_gardenset. Print the set to confirm it’s empty. - Make a copy of the
botanical_gardenset using thecopy()method. Add"lily"to the copy and print both sets to see the differences. - Create a frozen set
immutable_gardenwith elements"orchid","daisy","red rose". Try to add or remove an element and observe what happens. - Iterate over the
botanical_gardenset and print each element. - Use set comprehension to create a set
even_numberscontaining even numbers from 1 to 10. - Given a list of flowers
["rose", "tulip", "rose", "daisy", "tulip"], use a set to remove duplicates and print the unique flowers. - Check if
"sunflower"is in thebotanical_gardenset and print the result. - Use the
intersection_update()method to update thebotanical_gardenset with only the elements found inrose_garden. Print the updated set. - Use the
difference_update()method to remove all elements insmall_gardenfrombotanical_garden. Print the updated set.
