# 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)
ok i've got a question, when using sets when you say that you can add or remove an element but cannot change a value, not being able to change a value is that due to the set being unordered to begin with?, like i can add or remove but i can't change say if i have a 2 i can't change that to a 3 and that's what is meant by being unable to change a value?. Sorry absolute beginner here so i want to make sure i understand exactly what is meant by being unable to change a value.
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
Thanks to you, everything was clear. I learned set and moving to the next one!
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👍.
great content easy to understand.
Great tutorial as always! Nice and clear
Majestic
you are one of the best
beautiful explanation bro
loving it
VERY HELPFUL
thank you, great video and easy to follow!
Wow!
It was very helpful, thanks.
Very Help Full Thanks bro
nice
Good job!
Awesome
I am the thousandth guy to like , so I deserve the shoutout!!!
Thanks
ure amazing
thank you
God bless you bro.
Love it bro
❤❤❤
GREAT VIDEO!
Say you combine dishes and utensils into a list. How would you find the unique # of only dishes in that list?
Thank you for this
Thanks for the video my Bro.
Nice video bro
thx
thanks bro !
ok i've got a question, when using sets when you say that you can add or remove an element but cannot change a value, not being able to change a value is that due to the set being unordered to begin with?, like i can add or remove but i can't change say if i have a 2 i can't change that to a 3 and that's what is meant by being unable to change a value?. Sorry absolute beginner here so i want to make sure i understand exactly what is meant by being unable to change a value.
Thx Senpai
isnt eh {} are dictionaries and sets are (())?
wow this seems very useful
NİCEEEE
Thank you. :)
bro code is great
You are a Pro,
in the Python Bro .....
🤩🤩😎😎
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.
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
👍
noice
So the random printing only works with strings?
it also makes string interpolate randomly between ints if you have both in a set.
Better than my paid course
Yea I did
W Bro Code
For the algorithm.
: D
TH-cam algorithm comment
;)
bro codes
mnom
I am the first one to dislike to I deserve a shoutout
Thanks
nice