In this Python set program, we will create a set of favorite movies with the help of the below-given steps.
What is set?
Sets are used to store multiple items in a single variable.
The set is one of 4 built-in data types in Python used to store collections of data.
It is an unordered collection data type that is iterable, mutable and has no duplicate elements.
Set of favorite movies:
Steps to solve the program
1. Create a set using {}.
2. Add name of your favorite movies in the set.
3. Print the set to see the output.
Set = {"Avengers: Endgame","John wick","The Matrix"}
print("Set of movies: ",Set)
Output :
Set of movies: {'John wick', 'The Matrix', 'Avengers: Endgame'}
Related Articles
Python program to create two sets of books and find the intersection of sets.
Python program to find the longest word in a set.
Python program to create a set with some elements.
Python program to add an element to a set.
Python program to remove an element from a set.
Python program to find the length of a set.