How to Use Python Dictionaries + Lists of Dicts

Ғылым және технология

Here i cover the basics of working with dictionaries in Python. I go into creating, understanding keys and values and the interaction of lists in dictionaries and lists of dictionaries
-------------------------------------
twitter / jhnwr
code editor code.visualstudio.com/
WSL2 (linux on windows) docs.microsoft.com/en-us/wind...
-------------------------------------
Disclaimer: These are affiliate links and as an Amazon Associate I earn from qualifying purchases
mouse amzn.to/2SH1ssK
27" monitor amzn.to/2GAH4r9
24" monitor (vertical) amzn.to/3jIFamt
dual monitor arm amzn.to/3lyFS6s
microphone amzn.to/36TbaAW
mic arm amzn.to/33NJI5v
audio interface amzn.to/2FlnfU0
keyboard amzn.to/2SKrjQA
lights amzn.to/2GN7INg
webcam amzn.to/2SJHopS
camera amzn.to/3iVIJol
gfx card amzn.to/2SKYraW
ssd amzn.to/3lAjMAy

Пікірлер: 52

  • @damienang7863
    @damienang78632 жыл бұрын

    Thank you so much man! My school taught us about basics of dictionaries (without list of dicts) and there are lists of dicts included in assignment and they expects us do complete it. luckily there is this vid!!

  • @tidoblack2054
    @tidoblack20549 ай бұрын

    Amazing explanation, very simple, and straigtht to the point.

  • @kkaarroollpl1453
    @kkaarroollpl1453 Жыл бұрын

    Thats what i was looking for! Keep going with tutorials like that!!

  • @bencole8301
    @bencole83013 жыл бұрын

    Thanks for sharing again John!

  • @alejandroluisbarcala8481
    @alejandroluisbarcala8481 Жыл бұрын

    Thanks John! This video has been very instructive to me!

  • @dzeykop
    @dzeykop3 жыл бұрын

    Thank you John, great work, again

  • @jonathanspencer8142
    @jonathanspencer8142 Жыл бұрын

    Hi John, thank you for the video. It was very helpful.

  • @barnabykent6698
    @barnabykent6698 Жыл бұрын

    Excellent video, very useful. Thank you.

  • @brentsimpson3791
    @brentsimpson37912 жыл бұрын

    Thanks, you just cleared up some confusion. Thank you!

  • @Richard-yz2gy
    @Richard-yz2gy Жыл бұрын

    well explained, will watch more of your videos for sure, cheers

  • @chiamakamibeanu5142
    @chiamakamibeanu51422 жыл бұрын

    Thank you so much for this video. It was helpful.

  • @carstenschmucker9140
    @carstenschmucker91402 жыл бұрын

    Hi John, and thank you for the video! A few weeks ago I had the task to run through a dictionary/list combination to especially find/calculate new values and replace those values in the dict. I am only programming since last summer but I came across "recursive search". Have you done a video about it? (my dict was about 13000 entries so a pain in the... you know what I mean. It gave me bad headache. Thanks again! Carsten

  • @aminesahel4143
    @aminesahel41437 ай бұрын

    Thank you for this video. Very helpful!

  • @matiasluiso770
    @matiasluiso7706 ай бұрын

    Excellent explanation. Really thankfull.

  • @scyllajk2757
    @scyllajk27575 ай бұрын

    great bro, this is what I was looking for

  • @aicode2304
    @aicode23042 жыл бұрын

    Thank you for this video, you explained things no one else has explained. God bless

  • @JohnWatsonRooney

    @JohnWatsonRooney

    2 жыл бұрын

    Thank you very kind

  • @aicode2304

    @aicode2304

    2 жыл бұрын

    @@JohnWatsonRooney also, i know this sounds really random, but im asking people if they believe in an afterlife or in God. I dont want to take too much time away from you though

  • @princessnnene3901

    @princessnnene3901

    11 ай бұрын

    @@aicode2304Keep spreading the good word my friend! Jesus is the Way, the Truth and the Life! :)

  • @ahmedghareeb5027
    @ahmedghareeb5027 Жыл бұрын

    continue doing full python tutorial plz it will be very helpful !

  • @oglothenerd
    @oglothenerd2 жыл бұрын

    OMG! Another Linux user! Hey bro! I use Linux too!

  • @chisengalungu119
    @chisengalungu119 Жыл бұрын

    thank you very much for the great video. I have a question. How do you get the index of an item in an array(the array that is a value in a dictionary)

  • @krisztina5711
    @krisztina571111 ай бұрын

    thank you very much, it was very, very useful

  • @oldmonk494
    @oldmonk4942 жыл бұрын

    great video 👍😊

  • @ramonrochadev
    @ramonrochadev10 ай бұрын

    Really helpful, thanks a lot!

  • @JohnWatsonRooney

    @JohnWatsonRooney

    10 ай бұрын

    Glad it helped!

  • @damonchase4771
    @damonchase4771 Жыл бұрын

    Thank you for making this video

  • @JohnWatsonRooney

    @JohnWatsonRooney

    Жыл бұрын

    Glad it was helpful!

  • @GFreeland850
    @GFreeland8502 жыл бұрын

    Can you show for example, when you enter a US state if will show the capital of that state?

  • @rubao3000
    @rubao3000 Жыл бұрын

    Hey John, thanks for the video. What If I want to get all the elements of the same key name? For example, all values from ['size']? How could I do it?

  • @Riyoshi000

    @Riyoshi000

    Жыл бұрын

    Did you find an answer to that? Im trying to do the same now

  • @rubao3000

    @rubao3000

    Жыл бұрын

    ​@@Riyoshi000 Hey, man. I don't remember how I figured it out, but this may help you: products = [ {'name': 'shirt', 'size': 'M', 'price': 25.0}, {'name': 'pants', 'size': 'L', 'price': 45.0}, {'name': 'shoes', 'size': 10, 'price': 25.0}, {'name': 'shirt', 'size': 'M', 'price': 30.0} ] for i in products: print(i['size'])

  • @sandinstone

    @sandinstone

    Жыл бұрын

    @@rubao3000 Thanks it worked!

  • @LifeLongArtist
    @LifeLongArtist9 ай бұрын

    What do you do if you don't know the index or keys? Like when trying to autofill or auto grab data using a loop?

  • @K3lvin.J
    @K3lvin.J2 жыл бұрын

    How can I call the whole list of dictionary

  • @mauipomare6523
    @mauipomare65235 ай бұрын

    Backed me into a corner with that if it has lmk if it hasn't lmk

  • @ceballospy
    @ceballospy Жыл бұрын

    Do you have a video where you are making iteration over list of dicts and adding information from one list of dict to other?

  • @naveensrinivas21

    @naveensrinivas21

    Жыл бұрын

    U may use 'append' with the help of keys and values from a dictionary

  • @catyuzu3992
    @catyuzu3992 Жыл бұрын

    nice tutorial it surprise a little more in comparison with othhers

  • @easydatascience2508

    @easydatascience2508

    Жыл бұрын

    Useful. You can also watch my playlist, Many useful and fundamental for Python crash course tutorial.

  • @AMA-xi5vp
    @AMA-xi5vp2 жыл бұрын

    Hi mate, at the end of the video How do I print only all the 'color' key? I mean: if I had a large list of dictionaires I can't type always the index and then the key, instead, I would print only all the 'color' keys because I want to know all the colors are in. I hope its clear enough, thanks in andvance

  • @ferguswalker7345

    @ferguswalker7345

    2 жыл бұрын

    I'm new to python so take the suggestion with a pinch of salt, but I think you could use a for loop like this: for x in product: print(product[x][colour]) This should loop through all the dictionaries in the list, and for each one, print the colours available.

  • @vishalnm3836
    @vishalnm3836 Жыл бұрын

    thanks

  • @leonardoplaza7677
    @leonardoplaza7677 Жыл бұрын

    What if I just want to print all of the names? Not specifying the index, just the key. For example: `print(products['name'])` And get all the names?

  • @rooftoprumble7845
    @rooftoprumble7845 Жыл бұрын

    I have an issue that I can't seem to find anywhere. I have a dictionary with lists in it. All keys have multiple values which are integers how can I get the sum of each values in a specific key?

  • @JohnWatsonRooney

    @JohnWatsonRooney

    Жыл бұрын

    Hi - a dictionary key is a single value, not sure what you mean exactly. but you can get all the keys from a dictionary using yourdict.keys(). this will return a list of all the key values

  • @jorgeholguin2009
    @jorgeholguin20098 ай бұрын

    How do you access “itemid”: “1002” ?

  • @jorgeholguin2009

    @jorgeholguin2009

    8 ай бұрын

    Oh!. I got it! products[1] Don’t bother to answer

  • @officialonbekende9785
    @officialonbekende9785 Жыл бұрын

    user = input( something ) user1 = input( 1 ) user2 = input( 2 ) output = dict = { 'something' : { '1':'1'}, 'something2' : { '2':'2'}} how can i create something like that? that user can self input as many as he wants nested lists

  • @krisztina5711
    @krisztina571110 ай бұрын

    Hi, I ask you to write, which index access only 'Peti' or 'Zsolt' in my list. Thank you. project_d=[ {'Y':{'name':'Zsolt'}}, {'X':{'name':'Peti'}}, {'V':{'name':'Zsolt'}} ] for i in range(len(project_d)): print (project_d[i])

  • @mrboyban
    @mrboyban Жыл бұрын

    It is not complicate, people make the concept complicated, by talking too much. Teaching coding is about practicing not showing off what you understand about the topic.

Келесі