Python Programming Tutorial – 19 – Dictionary

///Python Programming Tutorial – 19 – Dictionary

Python Programming Tutorial – 19 – Dictionary

FavoriteLoadingAdd to favorites

Facebook – https://www.facebook.com/TheNewBoston-464114846956315/
GitHub – https://github.com/buckyroberts
Google+ – https://plus.google.com/+BuckyRoberts
LinkedIn – https://www.linkedin.com/in/buckyroberts
reddit – https://www.reddit.com/r/thenewboston/
Support – https://www.patreon.com/thenewboston
thenewboston – https://thenewboston.com/
Twitter – https://twitter.com/bucky_roberts

By |2017-05-01T12:20:42+00:00April 26th, 2017|Programming Video Tutorials, Python Video Tutorials|50 Comments

50 Comments

  1. Gustavo Luz April 26, 2017 at 9:27 pm - Reply

    Works on Python 2.7 as well! ๐Ÿ™‚

  2. youmovier April 26, 2017 at 9:28 pm - Reply

    MILF??? I would rather say GGILF

  3. StrawberryGates April 26, 2017 at 9:28 pm - Reply

    ‘she can be 87, she’s a MILF’ ha ha ha

  4. Priscilla Muriithi April 26, 2017 at 9:29 pm - Reply

    Correct syntax in 3.4.2

    >>> ‘mom’ in tuna
    False
    >>> ‘Mom’ in tuna

  5. amsfuy April 26, 2017 at 9:29 pm - Reply

    Don’t forget your sweet sister, bucky ๐Ÿ˜›

  6. elegantCommunist April 26, 2017 at 9:30 pm - Reply

    what do you mean in tuna?

  7. Darksource April 26, 2017 at 9:31 pm - Reply

    Use python 2 cause 3 is buggy.

  8. Kevin Kuzwayo April 26, 2017 at 9:34 pm - Reply

    the MILF part killed me lol

  9. Bhaskar Nair April 26, 2017 at 9:34 pm - Reply

    Hey

    The
    dictionary.has_key(‘Str’)
    is not supported anymore.. but i also don’t know what replaced it.. so fell free to comment a new function which can be used in this behalf…

  10. Patryk Wrzeszcz April 26, 2017 at 9:35 pm - Reply

    She is more like a GILF ๐Ÿ˜›

  11. Albert Schilling April 26, 2017 at 9:38 pm - Reply

    Since has_key() was removed in Python 3, I used the syntax: ‘string’ in variablestable.
    The strange thing about the "in-method" is, that you can only search for the variables, but not for the values.

    If you for example save {‘father’:’Jerry’} to your table or dicitionary or whatever you call it, you can only search for father not for Jerry. If you search for father, you’ll get True. If you search for Jerry. you’ll get False.

    Anyone knows why?

  12. NoYzE4 April 26, 2017 at 9:40 pm - Reply

    You actually mapped the string Dad and Mom to the String 42 and 87 O_o
    If you want an int, you should omit the ‘ ‘ ๐Ÿ˜›

  13. John Mayk Brito de Lima April 26, 2017 at 9:40 pm - Reply

    87 milf? haushuahsuahsuhasaoushaos
    wtf did you smoke, Bro Joe?

  14. Quinten Warren April 26, 2017 at 9:41 pm - Reply

    haha milf

  15. xxBIGBIRDxx April 26, 2017 at 9:44 pm - Reply

    Good to know

  16. Ster1234567890 April 26, 2017 at 9:45 pm - Reply

    Ok dude thats fucking scaryโ€ฆ my moms name is Lisa o_O…

  17. Pogi Ako April 26, 2017 at 9:49 pm - Reply

    haha mom’s a milf!

  18. K0NM April 26, 2017 at 9:50 pm - Reply

    joe the bro!

  19. 11swallowedinthesea April 26, 2017 at 9:53 pm - Reply

    If values can be integers, why have quotes? Why not:ย 

    book = { ‘Dad’ : 42, ‘Mom’ : 88}ย 

  20. Anurag Jha April 26, 2017 at 9:53 pm - Reply

    pls doo writeold and changes in new coz i m getting confused in key

  21. James Cuttell April 26, 2017 at 9:53 pm - Reply

    Import antigravity!

  22. Erick Igeon Jung Cho April 26, 2017 at 9:54 pm - Reply

    so if you want to put the age and the real name does it work like this= book={‘mom’: ’43”lisa’}?

  23. Videoorchard April 26, 2017 at 9:54 pm - Reply

    Thanx for letting us knw!

  24. Darkshadowdj April 26, 2017 at 9:55 pm - Reply

    In Python 3.2.

    Instead of – tuna.has_key(‘Mom’)

    You use – (‘Mom’) in tuna

  25. Atif Ahsan April 26, 2017 at 9:56 pm - Reply

    what is a practical example of Dictionaries ?

  26. parris compwiz April 26, 2017 at 9:58 pm - Reply

    Can’t believe he said MILF, my parents were like… What are you looking at? LOL, Nonetheless, Liked thanks for the info.

  27. Mkhuzo Mwanza April 26, 2017 at 9:58 pm - Reply

    She’s a Milf??? hahaha!!!

  28. Abdullah Al Masud April 26, 2017 at 10:02 pm - Reply

    why ‘bro’ cames ahead of ‘mom’ though during the code was being written , ‘mom’ was in prior place ??

  29. Mike Speak April 26, 2017 at 10:02 pm - Reply

    Hi Bucky, I am trying to learn python but I am stuck trying to make a list with input numbers. My problem is that I only want to print out 10 numbers but take a number of the [0] and put the last number in it so it will always show the last ten numbers?

  30. Ali Rezai April 26, 2017 at 10:03 pm - Reply

    I use Macbook pro V 10.11.6 . I trey to download wxpython its is download but its doesn’t install. could you tell me how to install that.

  31. Tobbe E April 26, 2017 at 10:03 pm - Reply

    str = "Hello there %s, how is your %s?"
    vars = ("Bob","Chevy")
    print(str % vars)

  32. elegantCommunist April 26, 2017 at 10:04 pm - Reply

    oooh woops i get it nevermind

  33. Jared Nielsen April 26, 2017 at 10:05 pm - Reply

    Great tutorial! Thanks!

  34. elegantCommunist April 26, 2017 at 10:05 pm - Reply

    oooh woops i get it nevermind

  35. spawn142001 April 26, 2017 at 10:06 pm - Reply

    Also i dont know how it is in 2. but in 3. You can just type tuna=ages the .copy() is unnecessary. Im not sure if in 2. you were required to do it for a dictionary, but when you say Tuna = Age you are saying i want to set tuna to equal whatever the hell age is.

    In 3.0 that works. When you type tuna you get {‘dad’:’42’, and so on}

  36. DivineAusir April 26, 2017 at 10:08 pm - Reply

    I think Bucky needs a new dictionary…

  37. Siboniso Dlamini April 26, 2017 at 10:10 pm - Reply

    a dic…tionary

  38. Zach Burton April 26, 2017 at 10:11 pm - Reply

    Great video , explained it very well

  39. PenguinCake April 26, 2017 at 10:13 pm - Reply

    Has_key has been removed in Python 3, so you just have to use ‘in’ ๐Ÿ˜‰

  40. Azzedine Addoun April 26, 2017 at 10:15 pm - Reply

    Hi bucky; thank you so much for your helpful tutorials, it is simple, clear and very-well explained, as I am new in this field of programming I would love to have more and more tutorials like yours. Also, if you can give us some exercises for practicing, it won’t be too much for me, thanks againย 

  41. ago6211 April 26, 2017 at 10:18 pm - Reply

    Milf xD

  42. rohan raj April 26, 2017 at 10:18 pm - Reply

    y only the curly braces

  43. Abhishek Sharma April 26, 2017 at 10:19 pm - Reply

    Versions from 3.0 doesn’t support has_key() method hence you need to use ‘In’ like
    (‘Mom’) in tuna (with or without parenthesis)
    this will return true
    also ‘in’ has better performance i.e run-time complexity than has_key()
    You can check it by using "-mtimeit"

  44. akwazza April 26, 2017 at 10:19 pm - Reply

    how to do it in python 3? :/

  45. Pat Letts April 26, 2017 at 10:21 pm - Reply

    Just for anyone wondering, has_key() was removed in Python 3. ‘in’ works just fine.

  46. Donald J. Trump April 26, 2017 at 10:21 pm - Reply

    ur fucked up dude

  47. rahul bhambri April 26, 2017 at 10:21 pm - Reply

    she is a milf ๐Ÿ˜€

  48. Maatla Lesley Lekone April 26, 2017 at 10:22 pm - Reply

    tuna.has_key(‘Mom’)
    Traceback (most recent call last):
    File "<pyshell#28>", line 1, in <module>
    tuna.has_key(‘Mom’)
    AttributeError: ‘dict’ object has no attribute ‘has_key’

  49. lolgast77 April 26, 2017 at 10:23 pm - Reply

    she’s a milf.

  50. Kra Siv April 26, 2017 at 10:24 pm - Reply

    Hi, bucky,
    thank you for the tutorials, I am learning python through them. However, now I use later version of Python and there are some differences between my compliler and what you teach, f.ex. I don’t have ย the "has_key" method

Leave A Comment

*