# set = collection which is unordered, unindexed. No duplicate values utensils = {"fork","spoon","knife"} dishes = {"bowl","plate","cup","knife"} #utensils.add("napkin") #utensils.remove("fork") #utensils.clear() #dishes.update(utensils) #dinner_table = utensils.union(dishes) #print(dishes.difference(utensils)) #print(utensils.intersection(dishes)) for x in utensils: print(x)
They're also great when you _want_ the uniqueness-property. If you use a list, an operation like appending lists has to be written by you (or a framework you use) to manually account for duplicate entries. Sets do it automatically, in C = faster again.
If I am not wrong, you can look to an unordered array for example, you can get any element of the array by the index without being necessary go through each element, but is not in a proper order
# set = collection which is unordered, unindexed. No duplicate values
utensils = {"fork","spoon","knife"}
dishes = {"bowl","plate","cup","knife"}
#utensils.add("napkin")
#utensils.remove("fork")
#utensils.clear()
#dishes.update(utensils)
#dinner_table = utensils.union(dishes)
#print(dishes.difference(utensils))
#print(utensils.intersection(dishes))
for x in utensils:
print(x)
Bro is the greatest coder ....
Just form your video's am starting to love coding thx a lot
Great tutorial as always! Nice and clear
Majestic
great content easy to understand.
❤❤❤
Thanks to you, everything was clear. I learned set and moving to the next one!
beautiful explanation bro
you are one of the best
Good job!
Very Help Full Thanks bro
nice
Wow!
The sets in python seems similar to what we studied in math class. Anyways, thank you for the free classes. Hope you are doing well👍.
Awesome
Say you combine dishes and utensils into a list. How would you find the unique # of only dishes in that list?
VERY HELPFUL
loving it
It was very helpful, thanks.
thank you, great video and easy to follow!
ure amazing
Thanks for the video my Bro.
Nice video bro
Thanks
God bless you bro.
thank you
Love it bro
GREAT VIDEO!
Thank you for this
NİCEEEE
👍
thx
I am the thousandth guy to like , so I deserve the shoutout!!!
isnt eh {} are dictionaries and sets are (())?
wow this seems very useful
Thx Senpai
thanks bro !
noice
An odd question perhaps, but what kind of situations do you use "sets" for? Why not stick with lists? What are the use cases?
They're also great when you _want_ the uniqueness-property. If you use a list, an operation like appending lists has to be written by you (or a framework you use) to manually account for duplicate entries. Sets do it automatically, in C = faster again.
Thank you. :)
is there any practical difference between "Ordered "and "Indexed"?
If I am not wrong, you can look to an unordered array for example, you can get any element of the array by the index without being necessary go through each element, but is not in a proper order
For the algorithm.
You are a Pro,
in the Python Bro .....
🤩🤩😎😎
: D
bro code is great
Better than my paid course
W Bro Code
So the random printing only works with strings?
it also makes string interpolate randomly between ints if you have both in a set.
Yea I did
;)
UA-cam algorithm comment
bro codes
mnom
I am the first one to dislike to I deserve a shoutout
nice
Thanks