Тёмный

Difference Between List, Tuple, Set and Dictionary in Python 

Kindson The Tech Pro
Подписаться 57 тыс.
Просмотров 155 тыс.
50% 1

Наука

Опубликовано:

 

31 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 143   
@KindsonTheTechPro
@KindsonTheTechPro 4 года назад
Hi guys, thanks for being there! You could support my channel by buying me a coffee buymeacoff.ee/PWsXo7h13
@Kemmydai
@Kemmydai 2 года назад
I was looking for a concise video to explain all these 4 concepts and stumbled on this. I have used all concepts before and needed clarification but I think this content needs to be updated. 1. Sets can be created using {} without the need for the 'set' keyword. E.g., set1 = { 'a' , 'b' , 1 } 2. Dictionaries can be created using the same curly braces '{}' but will only be considered to be a dictionary if and only if it takes in keys and values, which is quite obvious. 3. The other way to make a list or a tuple or a set or a dictionary is by using their keywords. E.g., list(), tuple(), set(), dict(). I just thought to point this out. Hope it helps!
@prabuchandrasekar3437
@prabuchandrasekar3437 2 года назад
we can define set using {}, what you used is type caset. for eg: set1={"apple","baanana","orrange"} print(set1) print(type(set1))
@flaredev
@flaredev Год назад
I was writing it, because a set can be defined with curly braces as well except that it doesn't take key-value pairs
@beastsole5308
@beastsole5308 Год назад
@ノウラ so once i give values to the set it becomes a dictionary?
@flaredev
@flaredev Год назад
@@beastsole5308 it is not really the value but you can say the syntax, if you put key-value pairs like following dict = {'key1': 1, 'key2': 2} it's a dictionary whereas in sets the elements are separated by commas like the following my_set = {1, 2, 3}
@BAGANDA7
@BAGANDA7 Год назад
finally mannn someone said it
@Nick12_45
@Nick12_45 10 месяцев назад
i sure love my favorite fruit, baanana 🐑👵
@ramprakash8420
@ramprakash8420 4 года назад
Sir you mentioned that you need to use the keyword "set" to create a set. But it is not necessary , all you have to do is to enclose the data in curly braces. Eg: a={ 1, 2, 3} If you need to create a dictionary then just add a key to the above set. Eg: a={ "first" : 1, "second" : 2 }
@bhavishyapancholi1063
@bhavishyapancholi1063 3 года назад
Thank u I understood . Tomorrow is my computer science finals 😂
@ritamchanda5913
@ritamchanda5913 2 года назад
Same bro and not even Tommorow it's today
@brighthhh7457
@brighthhh7457 2 года назад
@@ritamchanda5913 same bro in an hour
@Starkeweg
@Starkeweg Год назад
Bro I’m doing my finals rn
@21-abhikhillare8
@21-abhikhillare8 Год назад
@@brighthhh7457 same bro onli 50 min left
@pramukanavodh
@pramukanavodh Год назад
At least you watched this one day before. I am now heading to the exam hall 🤣
@AK-Star007
@AK-Star007 2 года назад
Good explanation, Adding my further understanding where to use them; List: Used in JSON format Useful for Array operations Used in Databases Tuple: Used to insert records in the database through SQL query at a time.Ex: (1.’sravan’, 34).(2.’geek’, 35) Used in parentheses checker Set: Finding unique elements Join operations Dictionary: Used to create a data frame with lists Used in JSON
@wiredupjax
@wiredupjax 2 года назад
Thank you - I wish you would explain WHY you would use dictionary vs set
@anirudhani4988
@anirudhani4988 4 года назад
And set can be directly mentioned with {} instead of set ([])
@epiccricketarena
@epiccricketarena 4 года назад
i also noted that
@udayjkc
@udayjkc 2 года назад
Kindson bro , curly braces can be used to define set try This > set1={'a','b','c'} print(type(set1))
@Naushad_jerry
@Naushad_jerry 5 лет назад
Sorry.... About set you are wrong, we can define our set in { } curly braces without key value paires for example : - Animal = {"cat","dog","cow"} and if case you want to check the type you can check by writing, print(type(Animal)) print(Animal). try it :)
@Naushad_jerry
@Naushad_jerry 5 лет назад
And yes we can define our set like this also :- Animal = set(["cat","dog","cow"])
@KindsonTheTechPro
@KindsonTheTechPro 5 лет назад
@@Naushad_jerry I think you are correct. Thanks for pointing that out!
@torment6425
@torment6425 5 лет назад
i was about to ask this too.
@MarkSudduth1
@MarkSudduth1 Год назад
Your explanation of the syntax used for sets is incorrect. While a set can be initialized with the use of set([1, 2, 3]), it can also be initialized with the use of curly braces {1, 2, 3}. The difference from dictionaries which also use curly braces is that dictionaries use a key-value pair for each item {"one": 1, "two": 2, "three": 3}, where a set uses a single value for each item. There is one notable exception where the use of curly braces cannot be used, for the initialization of an empty set because in this case the use of curly braces { } would actually create an empty dictionary. Also, all of these structures can be initialized by by use of their functions list(), tuple(), set(), and dict().
@easydatascience2508
@easydatascience2508 Год назад
You can watch mine too. The channel has both Python and R playlists, and downloadable source files.
@SageArbor
@SageArbor 3 года назад
Printing dictionary values by key ... for the above example code you could print out using >print(dict1[2]) which would print "Tuesday" For a more complicated example, if the third key instead of 3 was "thirdKey" then you could print it using : >print(f'dict1[thirdKey] = {dict1["thirdKey"]}')
@findlostphone5672
@findlostphone5672 2 года назад
Starting my data science in a weeks time and was looking for the explanation of 1:list 2:Tuple 3:Set and dictionary and I found out that this is a perfect one - easy to understand
@JJJJ-gl2uf
@JJJJ-gl2uf 2 года назад
Good intro to these Python topics. Thanks.
@KindsonTheTechPro
@KindsonTheTechPro 2 года назад
You are welcome!
@MalPlayss
@MalPlayss 2 года назад
This was really helpful and I understood everything. Thank you!
@cynthita93
@cynthita93 7 месяцев назад
Well explained! Thank you!
@KindsonTheTechPro
@KindsonTheTechPro 2 месяца назад
I"m so glad 😊
@stonedead1985
@stonedead1985 Год назад
hi, thanks for the video. whats' the IDE you're using on this video? it looks so cool and seems light, unlike the IDE I'm currently using. Takes time to load, and clumps most of my screen area.
@Uncle-Ronald
@Uncle-Ronald Год назад
no clue but i recommend pycharm community and slap a nice theme on it
@0_hb_0
@0_hb_0 3 года назад
Tuple is immutable Tuple is immutable Tuple is immutable
@anurudhacharyaji3715
@anurudhacharyaji3715 2 года назад
Love you Sir🥰
@KindsonTheTechPro
@KindsonTheTechPro 2 года назад
Many many thanks 😍😍
@Nick12_45
@Nick12_45 10 месяцев назад
list = ["Made with defining the variable with square braces []", "A way of storing multiple values with one variable.", "First value is also of the index", 0] tuple = ("The same thing as a list,", "except cannot be changed after declaration", "and is defined with normal braces ()") set = set(["Is declared by converting a list to a set", "with the set() function.", "technically has curly braces", "cannot be ordered", "also no duplicates", "sets actually can be defined with curly braces {} but you don't use the set() function BECAUSE THAT IS NOT HOW FUNCTIONS WORK AHHH", "this video also barely explained sets and only explained how to make them"]) dictionary = { "syntax": "uses \"key\":\"value,\" syntax instead of it being numbered 0...n", "description": "are not ordered... except they are, they just use key value syntax, and are pretty similar to objects"}
@sudeshnashomroy5992
@sudeshnashomroy5992 2 года назад
Thanks for the video
@dineshp9172
@dineshp9172 4 года назад
ur the best tq very much sir
@calebmoughkera-65
@calebmoughkera-65 Год назад
thank you so much bro (very clear)
@KindsonTheTechPro
@KindsonTheTechPro Год назад
You are welcome
@aryangaurvlogs820
@aryangaurvlogs820 Год назад
Oh u made my understand it like a penny task
@raunaklakdawala8439
@raunaklakdawala8439 2 года назад
Thanxx for such a nice explanation, I literally understood everything
@applymarket934
@applymarket934 4 года назад
Perfect Explanation of these four! Thanks Bro!
@jongab2761
@jongab2761 3 года назад
Hey may I ask? What IDE are you using?
@StorySoundsChannel
@StorySoundsChannel Год назад
thank you so much
@RGMUTEX
@RGMUTEX 2 года назад
awesome thank you so much, its really helpful
@matthewbrowne1561
@matthewbrowne1561 3 года назад
This makes so much sense When I did my coding project for my computer science exams I kept getting errors about “tuples” I didn’t know what a tuple was In hindsight I was declaring my lists using round brackets rather than square ones and the errors appeared when I tried to append the list 🤦‍♂️ Thanks btw
@liamwelsh5565
@liamwelsh5565 3 года назад
Normally list and tuples are taught at the same time.
@bowenyu2505
@bowenyu2505 2 года назад
It would be better if you can prepare everything before starting the recording. It just made us even more confused.
@KindsonTheTechPro
@KindsonTheTechPro 2 года назад
I think we all need debugging skills. Besides I put the explanation and link in the description www.kindsonthegenius.com/difference-between-list-tuple-set-and-dictionary-in-python/
@fanmanfamevlogs498
@fanmanfamevlogs498 3 года назад
Thank you
@thakurrajsinghnarangpur5356
@thakurrajsinghnarangpur5356 3 года назад
Sir your bakchodi is very well 😂
@private9062
@private9062 2 года назад
The reason it did not printed set1 with {} was becasue you had to delete thew word "set" thisset = {"apple", "banana", "cherry"} print(thisset)
@growwithstephanie
@growwithstephanie 3 года назад
Thanks for this explanation
@KindsonTheTechPro
@KindsonTheTechPro 3 года назад
Glad it was helpful!
@winlab7993
@winlab7993 5 лет назад
I like your python code editor... please what is the name of your IDE ???
@gregoryweb3
@gregoryweb3 2 года назад
What compiler did you use sir?
@KindsonTheTechPro
@KindsonTheTechPro 2 года назад
PyCharm IDE
@gregoryweb3
@gregoryweb3 2 года назад
@@KindsonTheTechPro Thank you so much, I hope you will make more python videos so that more student will gain knowledge of it .
@Engycation
@Engycation 3 года назад
Very Nice Video Go A Head
@schultzy1238
@schultzy1238 2 года назад
thank you for the great informative video!
@KindsonTheTechPro
@KindsonTheTechPro 2 года назад
Glad it was helpful!😊
@samisalahuddinnurmagomedov8456
@samisalahuddinnurmagomedov8456 4 года назад
Thank u soo much Kindson.. Is sets are mutable or immutable sir?
@KindsonTheTechPro
@KindsonTheTechPro 4 года назад
Sets are immutable.i.e it cannot be changed or replaced. Do remember to subscribe!
@prabuchandrasekar3437
@prabuchandrasekar3437 2 года назад
set1={"apple","baanana","orrange"} print(set1) print(type(set1)) correct definition of defining SET
@youmewe
@youmewe 5 лет назад
Very nice 👍
@KindsonTheTechPro
@KindsonTheTechPro 5 лет назад
Thanks
@SAM-ol5ip
@SAM-ol5ip 2 года назад
Thank you so much sir
@KindsonTheTechPro
@KindsonTheTechPro 2 года назад
Most welcome 😀
@NomeSports10
@NomeSports10 3 года назад
Thank you sir
@KindsonTheTechPro
@KindsonTheTechPro 3 года назад
You're welcome! 😊
@eragon0266
@eragon0266 3 года назад
OMW. The people that designed this so called "language" is so lost. I don't think they know their { from their [ to their (. So convoluted!! Before you shout at me...I am a professional RPG developer on the IBMi machine. (supposed to be archaic) Oh boy what am I putting myself through learning this crap. (and it seems it is the most popular language out there.....?? WHAT!!)
@ErickG
@ErickG 5 лет назад
Great explanation. Thank you!
@KindsonTheTechPro
@KindsonTheTechPro 5 лет назад
This is a motivation. Thanks
@shanthibhaskar9116
@shanthibhaskar9116 2 года назад
Nice bro
@itsmmdoha
@itsmmdoha 4 года назад
You wrote the title wrong It's #DIFFERENCE BETWEEN BETWEEN ....... but it's supposed to be #DIFFERENCE AMONG....... 😁 Whatever I needed this video Thanks for the lesson 😇
@KindsonTheTechPro
@KindsonTheTechPro 4 года назад
Thanks pal! Your point is noted. I appreciate any recommendation that can help me improve. Also please remember to subscribe as I'll be making better content!
@kchetwani1
@kchetwani1 Год назад
Ty
@sashwattanay
@sashwattanay 2 года назад
Thank you, teacher.
@Ashok-oe3lo
@Ashok-oe3lo 11 месяцев назад
set_ex = {1, 2, 3} print(set_ex) print(type(set_ex))
@Anuj_sk
@Anuj_sk 4 месяца назад
SET can also be used curly braces
@AnandAnand-uz6qo
@AnandAnand-uz6qo Год назад
Super sir where are you from
@suhanisingh106
@suhanisingh106 Год назад
Thnks
@ShahanRckz786
@ShahanRckz786 3 года назад
y is output of set changes the order every time ?
@mohammadaxelariapaskha9791
@mohammadaxelariapaskha9791 4 года назад
Thanks
@robinhood3841
@robinhood3841 4 года назад
Nice
@ramratan2004
@ramratan2004 3 года назад
Thanks for showing the concept of python basics...
@ghanshyamvishwakarma2343
@ghanshyamvishwakarma2343 3 года назад
thanks for this information thank you so much
@KindsonTheTechPro
@KindsonTheTechPro 3 года назад
Most welcome😊
@srinivasmohan1870
@srinivasmohan1870 3 года назад
Thank you so much Sir was very useful!!!!!!!
@ShinyArjunSingh
@ShinyArjunSingh 4 года назад
wow man...made my life.. Nice one Subscribed...Keep'em comin....
@soumyajeet7809
@soumyajeet7809 5 лет назад
Excellent explanation. Good job 👍👍
@ilyesbenaissa5357
@ilyesbenaissa5357 5 месяцев назад
You should explain in theory first then start implementing
@KindsonTheTechPro
@KindsonTheTechPro 2 месяца назад
Thanks for the feedback 😊
@munisqureshi8204
@munisqureshi8204 5 лет назад
Tomorrow is my paper😂
@KindsonTheTechPro
@KindsonTheTechPro 5 лет назад
Good. Remember to subscribe so you get updates when new lessons are made
@flappyBoi
@flappyBoi 4 года назад
Thankyou so much!
@makhzansabeel
@makhzansabeel 4 года назад
Well explained... It remove my doubts regarding these topics
@LuvxJacqu4li8e
@LuvxJacqu4li8e 2 года назад
Colon value then separated by commas? At 10:07
@KindsonTheTechPro
@KindsonTheTechPro 2 года назад
Nice point! I just checked it! Thanks!
@KeeganKapepe
@KeeganKapepe 4 года назад
Great works ! Thanks a lot
@vaibhavjamdale3726
@vaibhavjamdale3726 3 года назад
Sir really great and intresting video. Support U from 🧡💚🤍. 😍
@Troll_Panda
@Troll_Panda 3 года назад
So beautiful done all the steps and clearly understand . Beautiful ❤️
@KindsonTheTechPro
@KindsonTheTechPro 3 года назад
Thanks so much 😊
@everwelwisher
@everwelwisher 3 года назад
thanks sir very informative and useful to improve my skills
@abhinavkumar877
@abhinavkumar877 4 года назад
Sir you are wrong we can create set in python with curly braces, your syntax is wrong , you dont require set keyword here , Try this >>>> thisset = {"apple", "banana", "cherry"} print(thisset)
@sudiksha6475
@sudiksha6475 2 года назад
👍🏻
@Vicboiz
@Vicboiz 2 года назад
CAN ANYONE HELP ME PLEASE! my project is ok with either List or Tuple. if I don't need to change the values in the list so I should use Tuple?
@glenfordholder6441
@glenfordholder6441 3 года назад
great tutorial
@KindsonTheTechPro
@KindsonTheTechPro 3 года назад
Thank you! Cheers!😊
@pritishabanerjee4992
@pritishabanerjee4992 4 года назад
Thnk uuu
@neogiftsebanze5752
@neogiftsebanze5752 4 года назад
thanks this helped a lot.
@creationgaming1130
@creationgaming1130 4 года назад
Helped me a lot thx sir i hope you get more subscriber hare Krishna
@liambennett1878
@liambennett1878 3 года назад
Rounded braces 😁
@KindsonTheTechPro
@KindsonTheTechPro 3 года назад
😊
@RodrigoChagasOficial
@RodrigoChagasOficial 3 года назад
Thank you so much! =)
@Kiddie_Tale_s
@Kiddie_Tale_s 2 года назад
Hope ndo?
@felixudebunu5231
@felixudebunu5231 4 года назад
Good explanation. Love it.
@niteshsaini408
@niteshsaini408 5 лет назад
thanks sir
@hansonng4711
@hansonng4711 4 года назад
What's the purpose for using tuple since it couldn't be changed?
@PriyaAmar848
@PriyaAmar848 4 года назад
1-Using a tuple instead of a list can give the programmer and the interpreter a hint that the data should not be changed. 2-Reading data is simpler when tuples are stored inside a list. For example, [(2,4), (5,7), (3,8), (5,9)] is easier to read than [[2,4], [5,7], [3,8], [5,9]] 3-Tuple size is less than that of list for a given set of elements. Hope i helped you understand the purpose of Tuple.
@hansonng4711
@hansonng4711 4 года назад
baby sri thank you bro
@arpitbhansali4877
@arpitbhansali4877 3 года назад
please make it clear to yourself first, don't confuse people
@florent9555
@florent9555 4 года назад
you dont need the set function to create a set just { items... } is enough
@adtrshynarh4596
@adtrshynarh4596 2 года назад
Sir, you are wrong about the SET, Set has curly braces, for example Family_Name = {"Cat", "Tiger", "Lion"} while dictionary is this Family_Name = {"Surname": "Michael", "Middle_Name": "Jackson", "Age": 40}
@SasidharanAnnamalai
@SasidharanAnnamalai 3 года назад
#SasidharanAnnamalai
@sh-pb1cx
@sh-pb1cx 3 года назад
man pm me, i ll teach you how to code in pycharm)
@nandishkr7864
@nandishkr7864 4 года назад
Set elements are print in alphabetical order but there it is not happen
@darpommop9118
@darpommop9118 4 года назад
Интересно
@oldgraybeard3659
@oldgraybeard3659 4 года назад
I'm sorry. Your accent, pronunciation, and cadence is very (very!) distracting.
@shubhamv76
@shubhamv76 10 месяцев назад
Bro is learning how to Describe data types while explaining us the difference bw them
@KindsonTheTechPro
@KindsonTheTechPro 2 месяца назад
Not really. I understand the concepts quite well. I guess you mean I'm struggling with explaining while coding it out at the same time.
@katana6533
@katana6533 2 года назад
cringe video
@EgyptianFiferMods
@EgyptianFiferMods 5 лет назад
Thanks
@meravathmaheshnaik535
@meravathmaheshnaik535 4 года назад
Nice
Далее
Python lists, sets, and tuples explained 🍍
15:06
Просмотров 297 тыс.
Please Master These 10 Python Functions…
22:17
Просмотров 197 тыс.
Dictionary in Python
12:24
Просмотров 1,4 млн
This Is Why Python Data Classes Are Awesome
22:19
Просмотров 812 тыс.
25 nooby Python habits you need to ditch
9:12
Просмотров 1,8 млн
Learn Python OOP in under 20 Minutes
18:32
Просмотров 87 тыс.
Python dictionaries are easy 📙
8:06
Просмотров 247 тыс.
Python 101: Learn the 5 Must-Know Concepts
20:00
Просмотров 1,2 млн
iPhone or Samsung?
0:18
Просмотров 3,6 млн
Keyboard Cleaning Hack
0:36
Просмотров 19 млн