Python sets tutorial explained
#python #sets #set
#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)
------------------------------
Up In My Jam (All Of A Sudden) by - Kubbi / kubbi
Creative Commons - Attribution-ShareAlike 3.0 Unported- CC BY-SA 3.0
Free Download / Stream: bit.ly/2JnDfCE
Music promoted by Audio Library • Up In My Jam (All Of A...
------------------------------
# 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 Code I got to say that your vids are amazing and your explanations are clear and easy to understand , you and you videos thought me a lot about python and computer science, and you are the one who inspired me to learn this subject! . I would really like if you could make a PHP course . be safe , keep making epic videos and thank you a lot !! :)
Thanks to you, everything was clear. I learned set and moving to the next one!
Great tutorial as always! Nice and clear
VERY HELPFUL
thank you, great video and easy to follow!
It was very helpful, thanks.
Just form your video's am starting to love coding thx a lot
you are one of the best
Good job!
loving it
Majestic
GREAT VIDEO!
Awesome
Thanks for the video my Bro.
Thank you for this
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👍.
Love it bro
wow this seems very useful
nice
thank you
thanks bro !
Wow!
Thanks
Nice video bro
Better than my paid course
ure amazing
Thank you. :)
thx
Thx Senpai
Say you combine dishes and utensils into a list. How would you find the unique # of only dishes in that list?
I am the thousandth guy to like , so I deserve the shoutout!!!
NİCEEEE
❤❤❤
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.
Yea I did
isnt eh {} are dictionaries and sets are (())?
W Bro Code
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
So the random printing only works with strings?
it also makes string interpolate randomly between ints if you have both in a set.
For the algorithm.
: D
;)
KZhead algorithm comment
mnom
bro codes
I am the first one to dislike to I deserve a shoutout
nice