Hello and welcome to this lecture of our course.
Today we will going to talk about sets.
Sets is data structure which represents a collection of specific elements Example set underscore one equal set
set one dote add a set one.
set one dote add (b) set one dote add (c) x = len(set) print(x) we will get 3
y = d in set print(y) False y = d in set print(y) False
why it is preferred to use sets? this firstly it's a very fast code operation on set then less is more appropriate in a list if we
have a larger collection of items that we want to use for elements present in Set X equal one two three
four five six.
Suppose we have at least contain one two three four five six seven eight nine ten print open parentheses
one in set open parentheses X close parenthesis , 15 in set of open parentheses x parentheses
comma twenty in set open parentheses close parentheses close the First parenthesis we will get
True false false
So it is more fast than lists we will try our lines of code in jupyter notebook set underscore
one equal set open parentheses close parentheses
set underscored one dote add a and b and c then X equal length set one print X equals three y equal
D and set one print y false z equals C and set one print set
print set one C and B and A
then X equals one two three four five six seven eight nine ten print one and set x 15 and set x twenty X
True false False
Thank you for watching.
See you next lecture.