Python - Set Exercises


Test Yourself With Exercises

Now you have learned a lot about sets, and how to use them in Python.

Are you ready for a test?

Try to insert the missing part to make the code work as expected:


Exercise:

Check if "apple" is present in the fruits set.

fruits = {"apple", 
"banana",
"cherry"} if "apple" fruits: print("Yes, apple is a fruit!")

Go to the Exercise section and test all of our Python Set Exercises:



Login
ADS CODE