Google News
logo
Python Program to Create a set
In the following example of Python program to create a set :
Program :
my_set = {1, 2, 3, 4, 5}
print(my_set)
Output :
{1, 2, 3, 4, 5}
In this example, we define a set `my_set` that contains the elements 1, 2, 3, 4, and 5. The set is created using curly braces `{}` with each element separated by a comma. We then print the set using the `print()` function.