48. Problem to create a set of favorite actors

In this Python set program, we will create a set of favorite actors 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 actors:

Steps to solve the program

1. Create a set using {}.
2. Add name of your favorite actors in the set.
3. Print the set to see the output.

				
					Set = {"Shan Rukh Khan","Akshay Kumar","Tom Hardy","Robert Pattinson"}
print("Set of actors: ",Set)
				
			

Output :

				
					Set of actors:  {'Shan Rukh Khan', 'Akshay Kumar', 'Robert Pattinson', 'Tom Hardy'}
				
			

Related Articles

create a set of odd numbers from 1 to 20.

create a set of your favorite movies.

Leave a Comment