How to create a set in python

Set

Set is an unordered collection of items separated by commas 

and the items are enclosed in curly brackets { }. A set is 

similar to list, except that it cannot have duplicate entries. 

Once created, elements of a set cannot be changed.

Run this code in python or online python compiler to create a set

#Create set

set1 = {10,20,30,40,50}

#print the elements of set 1

print (set1)


Comments

Popular posts from this blog

How to add comments in python ?