0:07 - Terminology 0:14 - Key/Value pairs definition 0:37 - First example (Student using a dictionary) 0:45 - { }, Dict notation, curly braces, 0:50 - adding elements 1:32 - [ ] Square bracket access of the dict 2:04 - Dict items can be many things, they’re not bound to one “type” 2:14 - Keys can be any immutable data type 2:24 - Example of an Integer being the key 2:44 - Accessing a key that does not exist 3:00 - Alternative to “throwing an error” if a key does not exist 3:05 - Sometimes you will want to return None or a default value if key does not exist 3:09 - .get( ) access of the dict 3:30 - accessing a key that does not exist with the .get method as opposed to [ ] square bracket access 3:40 - Specifying a default value for keys that do not exist 4:01 - Adding a new entry to dictionary 4:30 - Changing/updating values via key access 5:02 - Changing/updating values via .update() method 5:21 - .update() takes in a dict as an argument 5:57 - Deleting a specific key and its value 6:01 - Option 1 for deleting a key and value: del keyword 6:26 - Option 2 for removing a key and value: .pop() method 6:30 - Remember the .pop() method not only removes the item put pops it off or returns it to you 6:35 - Therefore you can recover the popped item with a variable assignment 7:07 - How to loop through all the keys and values 7:13 - Finding out the number of keys in dict with len() function 7:30 - Print all keys with .keys() method 7:39 - Print all values with .values() method 7:47 - Print both keys and values with .items() method 8:07 - Looping is slightly different then lists because dicts are concerned with pairs (Key : Value) 8:33 - How to loop through keys AND values
I'm applying for Masters in Data Science and I just want to say that by following your videos, I will be able to develop a strong base and maybe would be able to fulfil my dreams in a long run all the contribution goes to you Mr Corey Schafer I'm thankful to God that I found your channel.
You are absolutely a lifesaver! My compsci prof is really smart, but absolutely terrible at explaining things efficiently. I understand more about dictionaries now after your 10-minute video than I previously did after my 3-hour lecture. Thank you so much, I will definitely be subscribing and donating to your patreon in the future! (once covid is over and I have a job again ):)
Yea seems like a lot of teachers r like that I’ve noticed a lot of these ppl who know compsci say they were self taught so it’s not like a regular class that would have traditional methods of teaching
I was struggling to learn Python.Even I took a course to learn Python.But I will Thumbs UP to you for explaining all the topic in such a easy.Your videos are the best.With each video, I am gaining confidence.
You literally explained lists and dictionaries in the simplest terms possible. Thank you so much, I don’t know why professors cannot be like this. You literally gave me more of a clear understanding with the logic and the syntax behind creating dictionary lists with keys and values, as opposed to how my professor does it. Thanks so much. I subscribed. Looking forward to more tutorials.
I already took a graduate course for intro level Python-- and your videos are honestly better! chugging through the beginner videos as a refresher and I cannot wait to jump into the more advanced topics. I feel so lucky for finding such a great resource-- and it was easy, your videos are so widely reccomended! Thank you for developing such an great and accessible course.
how well do you know python now? I'm about to watch the next video after this dictionary one. Gonna continue on but just wondering has it benefited you yet?
What a Legend! Someone going out of his way just to make knowledge available to others... that is Special. Congratulations Corey, these videos are awesome !
This was one of the most straightforward clear explanations that I have ever seen. I'm trying to get a batchelors in compsci even though I had previously never written a single line of code, and this really helped! Thank you!
Man u should be python teacher a great teacher who can explain everything so easily after watching u r video i m having no doubts i m in 11th commerce 😅
Finally, I a feeling confident about programming, I have been trying from so many months just to learn the concepts I have given so many attempts before this as well. Just to memorize the concepts all the time. However, back in the time I found that stuff really difficult to remember. Now with these videos, I can learn how to code and it is really easy to memorize the concepts as well, the way you explain things, it is really awesome, I really appreciate your work. Thank you, Mudhit Kumar
Just from the start of the video I knew you sounded professional. I paused and cake to the comment section and saw a lot of these people learnt. I have just started to actually learn this all. Don’t know any of the languages. If I find this helpful I could probably donate.
Hey Corey, I know these videos are geared towards beginners like myself - and also a few years old at this point - but it would be helpful to explain how each concept in the tutorials are used in the real world, beyond just printing out values. Hopefully this makes sense! Thank you for the instruction - I appreciate your teaching style
He kinda does that... The code he used *could* be used in a program that calculates a student's grades or keeps track of them like google classroom. However, it was simplified for the video. Hope this helps
You are saving all of my bacon. I didn't know anything about dictionaries before entering into grad school that assumed I was very familiar with them. This is everything. Thank you~~~
These are the best article i have found. I completed python from other sources and someone referred me your pandas tutorial they are just awesome. After watching your pandas tutorial wants to again go through all these python tutorial.
I have made a notebook to write down the notes and key points . I dont have to suffer in my college learning basics . I can move forward to advance topics So grateful to you and your indepth Explanation
It so funny I put "find me a video that explains sets and dictionaries in py better than my professor " into ChatGPT and it recommended me this Corey's content. So cool.
This is the second time I looked up something about Python on youtube. This was so well explained that I wanted to sub, but apparantly you were also the guy who explained regexes like perfectly, therefore I already subbed.. Thanks for keeping programming fun!
Thanks again. I actually thought I knew python dictionaries. Now I feel like Jon Snow. I know nothing. I could have saved a bunch on Udemy if I had found you first.
I've RUclips adblocker but I disable it when watch your channel and I don't skip the add so that you can earn the minimum for providing such an wonderful platform for us to learn
dude...this just explained so much to me in such little time. I have been scratching my head for a while over things and not really understanding some looping within these dictionaries, but your explanation makes so much more sense that its actually starting to come together. Thank you.
You are amazing, went through other platform courses, even paid ones, but your's is simply amazing. Thank you for existing 🙏. The way you explain every detail that too without letting us feel pressurized is so rare.🥺 Thanks a lot sir 🙏🙏
Pótsa Tamás in fact these videos are for learning but if need a certificate that u have a completed a course on python by writing the exams then u can't rely on them:)
Thank you so much for these videos. I have tried learning Python through EDX and Brilliant. EDX was good but in two of your videos, I learned more than in several hours of EDX. Brilliant has a wide variety of courses, so judging it on one alone isn't perhaps fair. However, for the time I put in, the knowledge I received was minimal Here, in just a few hours of learning, I feel really comfortable in writing basic code and am looking forward to all your future videos. I've lost my income so can't commit to a monthly payment but will send a one-off for now Thanks so much
Currently doing the Python crash course by Coursera and this is just sooooo much better. Amazingly happy I found these videos. Extremely well explained.
You can copy my code and test it for more practice hehe :) that's for free hehe foods = { "pizza": 20, "burger": 40, "hotdog": 30, "pasta": 25, "salad": 15, "steak": 50 } order = [] total = 0 print("Menu:") for food, price in foods.items(): print(f"{food}: ${price:.2f}") while True: food = input("Enter the food you'd like to order or q to quit: ").lower() if food == "q": break elif food not in foods: print("Invalid food item!") else: order.append((food, foods[food])) total += foods[food] print(f"{food} added to order. Total cost so far: ${total:.2f}") print("Order summary:") for item in order: print(f"{item[0]}: ${item[1]:.2f}") print(f"Total cost is: ${total:.2f}")
Having studied the Python Institute PCAP course, I'm finding this very helpful and I am experiencing some topics that weren't touched, which are useful for data analysis. Stuffs like union, intersection and difference... I'll definitely be watching till the end and will watch all videos again... Thanks for this...
I've struggled to understand syntax but you've been very clear and explained the 'why' of what to type and functions to call perfectly. Thank you so much! I feel like i'm truly learning and getting it!
Thanks a bunch to you Corey, I tried to learn Python from a number of resources, but I am able to understand and continue only your explanation. Your selfless service means a lot to a whole lot of people. I am learning Python to do some competitive programming, if possible can you make some videos which would need some logical thinking and apply algorithms in Python, which could set the path to take up competitive programming.
thank you sir, your videos are of great help for people who can't afford expensive courses on various sites. so please keep making such good videos best of luck from INDIA
I really gotta get the hang of Dictionaries, Lists and Tuples. Looks like I have to re-watch this video many times for my brain to finally figure it out. I love your video, very well explained..... :) I just have to memorize it, if my brain decides to wake the hell up some day.....LOL
I was struggling with a practice project in automate the boring stuff where you basically have to make a fantasy inventory. I couldn't figure it out and everywhere I looked I ended up finding solutions like 'print(str(inventory[item]) + ' ' + item)' for this one particular line. Confusing as shit. All I had to do is watch this video and realize it's as easy as writing print(key, value). Maybe there are benefits to the former, but my point is that this channel has been VERY helpful in putting everything in lamens terms... THANK YOU!
The tutorial you provided is pretty awesome, which is greater than most of the MOOC course, I am looking forward to the python re module tutorial. BTW, your English accent is awesome toooooo, which makes a lot of things that easy understood for the people that come from other language. Thanks
i wish youtube had recommended me this video earlier.Now i feel like i kinda wasted some time on other tutorials..anyways ...good job..nice lecture. :D
0:07 - Terminology
0:14 - Key/Value pairs definition
0:37 - First example (Student using a dictionary)
0:45 - { }, Dict notation, curly braces,
0:50 - adding elements
1:32 - [ ] Square bracket access of the dict
2:04 - Dict items can be many things, they’re not bound to one “type”
2:14 - Keys can be any immutable data type
2:24 - Example of an Integer being the key
2:44 - Accessing a key that does not exist
3:00 - Alternative to “throwing an error” if a key does not exist
3:05 - Sometimes you will want to return None or a default value if key does not exist
3:09 - .get( ) access of the dict
3:30 - accessing a key that does not exist with the .get method as opposed to [ ] square bracket access
3:40 - Specifying a default value for keys that do not exist
4:01 - Adding a new entry to dictionary
4:30 - Changing/updating values via key access
5:02 - Changing/updating values via .update() method
5:21 - .update() takes in a dict as an argument
5:57 - Deleting a specific key and its value
6:01 - Option 1 for deleting a key and value: del keyword
6:26 - Option 2 for removing a key and value: .pop() method
6:30 - Remember the .pop() method not only removes the item put pops it off or returns it to you
6:35 - Therefore you can recover the popped item with a variable assignment
7:07 - How to loop through all the keys and values
7:13 - Finding out the number of keys in dict with len() function
7:30 - Print all keys with .keys() method
7:39 - Print all values with .values() method
7:47 - Print both keys and values with .items() method
8:07 - Looping is slightly different then lists because dicts are concerned with pairs (Key : Value)
8:33 - How to loop through keys AND values
Nice, this helps, thanks
thank u
God among men.
How do you write a list with all the content with links like this?
@@andyn6053 diligent note taking. and you make the links by typing the time like 1:02
I'm applying for Masters in Data Science and I just want to say that by following your videos, I will be able to develop a strong base and maybe would be able to fulfil my dreams in a long run all the contribution goes to you Mr Corey Schafer I'm thankful to God that I found your channel.
Hello can you help me out? I am also pursuing MS in Data Science. Give me some valuable advice.
@@anindiansquirrel bro prolly died its been 4 years
@@r3ylow lol haha your funny man
@@anindiansquirrel oNLY IF IWERE A MAN 💔💔💔💔 LMAO
@@r3ylow uh oh. sorry babes :)
You are absolutely a lifesaver! My compsci prof is really smart, but absolutely terrible at explaining things efficiently. I understand more about dictionaries now after your 10-minute video than I previously did after my 3-hour lecture. Thank you so much, I will definitely be subscribing and donating to your patreon in the future! (once covid is over and I have a job again ):)
most compsci profs ive noticed r too smart to teach newcomers
did you donate him
Fulfill thy promise and donate, my child.. or face the wrath of our comments
Yea seems like a lot of teachers r like that
I’ve noticed a lot of these ppl who know compsci say they were self taught so it’s not like a regular class that would have traditional methods of teaching
@@majormac7814 I would call it arrogance lol
I was struggling to learn Python.Even I took a course to learn Python.But I will Thumbs UP to you for explaining all the topic in such a easy.Your videos are the best.With each video, I am gaining confidence.
Thanks! Glad you're learning and finding these helpful!
You literally explained lists and dictionaries in the simplest terms possible. Thank you so much, I don’t know why professors cannot be like this. You literally gave me more of a clear understanding with the logic and the syntax behind creating dictionary lists with keys and values, as opposed to how my professor does it. Thanks so much. I subscribed. Looking forward to more tutorials.
I already took a graduate course for intro level Python-- and your videos are honestly better! chugging through the beginner videos as a refresher and I cannot wait to jump into the more advanced topics. I feel so lucky for finding such a great resource-- and it was easy, your videos are so widely reccomended! Thank you for developing such an great and accessible course.
hello
Best Python tutorials on the planet!
true
how well do you know python now? I'm about to watch the next video after this dictionary one. Gonna continue on but just wondering has it benefited you yet?
@@vinaynair1911 yeaaaaaa'
Corey has the best Python tutorial in my 3 years of trying about everything
What a Legend! Someone going out of his way just to make knowledge available to others... that is Special. Congratulations Corey, these videos are awesome !
Mr. Schafer, I've never felt so close to learning these concepts after spending so many Python courses... I will be donating for sure.
These tutorials are some of the best that I have seen out and cover a wide assortment of topics from Beginner to Advanced. Great Work Man!
This was one of the most straightforward clear explanations that I have ever seen. I'm trying to get a batchelors in compsci even though I had previously never written a single line of code, and this really helped! Thank you!
BEST TUTORIAL EVER!!!!!!!!!!!!! glad I found it recommending it to all my friends in college
The 9 minutes of this tutorial is far better than the 1 hour tutorial I learned from Udemy . Thanks, Corey
No jokes
Man u should be python teacher a great teacher who can explain everything so easily after watching u r video i m having no doubts i m in 11th commerce 😅
Finally, I a feeling confident about programming, I have been trying from so many months just to learn the concepts I have given so many attempts before this as well. Just to memorize the concepts all the time. However, back in the time I found that stuff really difficult to remember. Now with these videos, I can learn how to code and it is really easy to memorize the concepts as well, the way you explain things, it is really awesome, I really appreciate your work.
Thank you,
Mudhit Kumar
Just from the start of the video I knew you sounded professional. I paused and cake to the comment section and saw a lot of these people learnt. I have just started to actually learn this all. Don’t know any of the languages. If I find this helpful I could probably donate.
Hey Corey, I know these videos are geared towards beginners like myself - and also a few years old at this point - but it would be helpful to explain how each concept in the tutorials are used in the real world, beyond just printing out values.
Hopefully this makes sense! Thank you for the instruction - I appreciate your teaching style
He kinda does that... The code he used *could* be used in a program that calculates a student's grades or keeps track of them like google classroom. However, it was simplified for the video. Hope this helps
Just wanted to say you are awesome. Thanks for the videos.
Finally someone who explains this stuff in a much simpler and less confusing way. Thank you so much!
hey, are you programmer or python expert now?
You are saving all of my bacon. I didn't know anything about dictionaries before entering into grad school that assumed I was very familiar with them. This is everything. Thank you~~~
I love Corey's videos, they're super simple and straight to the point, and explain everything very well.
These are the best article i have found. I completed python from other sources and someone referred me your pandas tutorial they are just awesome. After watching your pandas tutorial wants to again go through all these python tutorial.
I have made a notebook to write down the notes and key points . I dont have to suffer in my college learning basics . I can move forward to advance topics
So grateful to you and your indepth
Explanation
It so funny I put "find me a video that explains sets and dictionaries in py better than my professor " into ChatGPT and it recommended me this Corey's content. So cool.
This is the second time I looked up something about Python on youtube. This was so well explained that I wanted to sub, but apparantly you were also the guy who explained regexes like perfectly, therefore I already subbed.. Thanks for keeping programming fun!
Glad to see you with totally refreshed Python Tutorials, Thank you so much Corey!
Thanks again. I actually thought I knew python dictionaries. Now I feel like Jon Snow. I know nothing. I could have saved a bunch on Udemy if I had found you first.
I could say exactly the same thing.
@@MegaJohn144 Udemy is crap
@@andyn6053 Yes, Udemy sucks. It would be better and cheaper to just buy a book and read it!
i'm glad i didnt use udemy so fast...
JON SNOW LOL
I swear to god this is the only video on youtube that actually properly explains dictionaries without overcomplicating.
I dnt how this video ended on my recommended list but its great. Your tutorials are far better than paid tutorials. Subcribed to your channel., 👍
The best, most clear and concise description I've found. Good job!
hey, are you programmer or python expert now?
Teaching like this is gold.
You can see my playlist too. The channal has Python and R playlist for fundamental tutorials. Source files available too.
These were the tricky ones. I'm a python learner and I was stuck in one of my practice problems. Thanks for this great video Corey!
I've RUclips adblocker but I disable it when watch your channel and I don't skip the add so that you can earn the minimum for providing such an wonderful platform for us to learn
dude...this just explained so much to me in such little time. I have been scratching my head for a while over things and not really understanding some looping within these dictionaries, but your explanation makes so much more sense that its actually starting to come together. Thank you.
You are amazing, went through other platform courses, even paid ones, but your's is simply amazing. Thank you for existing 🙏. The way you explain every detail that too without letting us feel pressurized is so rare.🥺 Thanks a lot sir 🙏🙏
Yes, He is. Thank You for praising my Guru! #KeepLearning
Here's an advanced tutorial for python dictionaries if you want to learn more: ruclips.net/video/iMG29UpCRZQ/видео.html
very simple and nicely put....am a python enthusiast and everyone I learn something from your videos
I'm studying Python on DataQuest and this channel is amazing to compliment the theory. Mos def will be donating soon!
Thanks!
is dataquest free?
Mega Raph nope
@@sazopro did you pay for it?
Mega Raph yes
WOW! that was clear, straight to the point, and perfectly explained!!! Thank you so much!
I've been learning Python for a while, and you are gifted. Many thanks
This courses are really helpful! Saves a LOT of time and money! Thank you very much!
Pótsa Tamás in fact these videos are for learning but if need a certificate that u have a completed a course on python by writing the exams then u can't rely on them:)
no one cares for certificates knowledge is everything
Corey, you are a brother from another mother. You make stuff really easy to understand.
Wow! I didn't fall asleep while watching the video. It is precise and easy to understand.
Thank you so much for these videos.
I have tried learning Python through EDX and Brilliant.
EDX was good but in two of your videos, I learned more than in several hours of EDX.
Brilliant has a wide variety of courses, so judging it on one alone isn't perhaps fair. However, for the time I put in, the knowledge I received was minimal
Here, in just a few hours of learning, I feel really comfortable in writing basic code and am looking forward to all your future videos.
I've lost my income so can't commit to a monthly payment but will send a one-off for now
Thanks so much
Thanks!
Best python tutorials I ever found....
8
Shot and quick; yet covering all the important aspects of the topic.
Many thanks.
Key = word and Value = Definition. This made the penny drop, I get dictionaries now! Thank you.
When I will become a data analyst I will donate for your work
Incredible work
Great better than my college teachers
Thanks!
Between you and Mosh, I don't know of a better way to learn Python. Thank you so much.
I am taking a class at my local College, and your videos are a great supplement to the topics in the class!!! Thank you!
+ Methods : 3:00
.get()
.update()
del dictname[]
.pop()
len()
.keys()
.values()
.items()
+ Looping : 8:10
for key, value in students.items()
Currently doing the Python crash course by Coursera and this is just sooooo much better. Amazingly happy I found these videos. Extremely well explained.
You can copy my code and test it for more practice hehe :) that's for free hehe
foods = {
"pizza": 20,
"burger": 40,
"hotdog": 30,
"pasta": 25,
"salad": 15,
"steak": 50
}
order = []
total = 0
print("Menu:")
for food, price in foods.items():
print(f"{food}: ${price:.2f}")
while True:
food = input("Enter the food you'd like to order or q to quit: ").lower()
if food == "q":
break
elif food not in foods:
print("Invalid food item!")
else:
order.append((food, foods[food]))
total += foods[food]
print(f"{food} added to order. Total cost so far: ${total:.2f}")
print("Order summary:")
for item in order:
print(f"{item[0]}: ${item[1]:.2f}")
print(f"Total cost is: ${total:.2f}")
Best tutorial on RUclips and in the world
Having studied the Python Institute PCAP course, I'm finding this very helpful and I am experiencing some topics that weren't touched, which are useful for data analysis. Stuffs like union, intersection and difference... I'll definitely be watching till the end and will watch all videos again... Thanks for this...
You deserve 10 million subs, You are simply amazing!!
I've struggled to understand syntax but you've been very clear and explained the 'why' of what to type and functions to call perfectly. Thank you so much! I feel like i'm truly learning and getting it!
Glad to hear that!
Effortless and excellent teaching by a born teacher.
This video was the best 10 mins I have had in a while.
I love you corey. you really make my experience with python so much better
You have the best python tutorials on youtube without any doubt Corey!
This is hands down the most detailed tutorial series I ever had, Thank You, Corey!!
This is so much better than Programming Knowledge.
Thanks a bunch to you Corey, I tried to learn Python from a number of resources, but I am able to understand and continue only your explanation. Your selfless service means a lot to a whole lot of people.
I am learning Python to do some competitive programming, if possible can you make some videos which would need some logical thinking and apply algorithms in Python, which could set the path to take up competitive programming.
hey, are you programmer or python expert now?
thank you sir, your videos are of great help for people who can't afford expensive courses on various sites.
so please keep making such good videos
best of luck from INDIA
Yes, the tutorials here are vastly better - really better.
These are the kind of channels that I subscribe to, very insightful
This is exactly what i was looking for. The best explanation ever.
Consistently the best and most efficient videos on every subject you cover!
Great Video to help me get a grasp on how dictionaries work! keep up the great work, you are a great instructor!!!
I really gotta get the hang of Dictionaries, Lists and Tuples. Looks like I have to re-watch this video many times for my brain to finally figure it out.
I love your video, very well explained..... :) I just have to memorize it, if my brain decides to wake the hell up some day.....LOL
This is the best Channel on Python.
These videos are very well designed! Thank you for your efforts of creating informative python videos!
I am glad that I found your channel. It is really going to be helpful, thanks mate!
Of all the Python videos tutorials you are the best. Very practical and clean concept and usage and fun in learning.
Short and straight to the point. Nice vid m8
Okay You Sir are a legend! Thank you very much for these Tutorials. hands down best Python Tutorials on Internet
I was struggling with a practice project in automate the boring stuff where you basically have to make a fantasy inventory. I couldn't figure it out and everywhere I looked I ended up finding solutions like 'print(str(inventory[item]) + ' ' + item)' for this one particular line. Confusing as shit. All I had to do is watch this video and realize it's as easy as writing print(key, value). Maybe there are benefits to the former, but my point is that this channel has been VERY helpful in putting everything in lamens terms... THANK YOU!
The day i'll get my first salary i'll surely contribute!
for now only i can say is Thank you so much!
Thanks!
did u get?
@@-jrstudio6137 Not yet :D
@@kaustubh.sharma good luck
@@oussamaazoui8237 :)
awesome, I see example problem in my book with answer and cannot figure it out but your video explains. Helped me at 8:32
Really great videos! You are way better than my university teacher in explaining things!
best explanations eveeeeerrrr.... Thanks a lot man your tutorials are way better than anyone else's
Great Sir. I larned more than my University classes.
i never saw this such great work on youtube related to programming
thank man
Quick concise information. CLEAN. Thank you sir! Best I have found on youtube so far.
You're a really good teacher. You make things so easy. Thank you for your videos.
Your videos are just wow. Simple and easy to follow. Thank You for this amazing work
Very good tutorial. Thanks to you, I now understand dictionaries better.
The tutorial you provided is pretty awesome, which is greater than most of the MOOC course, I am looking forward to the python re module tutorial. BTW, your English accent is awesome toooooo, which makes a lot of things that easy understood for the people that come from other language. Thanks
hey, are you programmer or python expert now?
Ayyyy cramming for my final is now seeming doable!
This is one of the best ever to encounter video explanation. The content is clearly explained and much easy to understand. Thanks bro...
Thank you Corey for your time and effort. Keep spreading the knowledge.
he will but you donate
You have the gift of making it easy and interesting to learn. Thanks
I just needed to say how awesome your tutorials are!!!
Please keep it up and make new tutorials.
Thanks!
i wish youtube had recommended me this video earlier.Now i feel like i kinda wasted some time on other tutorials..anyways ...good job..nice lecture. :D
lol, youtube thinks earlier.now is a website
wow, thank you. This video was very straight forward and easier than reading a book.
I really do feel comfortable with dictionaries now! Thanks a lot.
life savior of a video. God bless you.
I've been really enjoying and learning a lot from these videos. Thank you very much for doing this, it's really appreciated!
Many thanks! A great hug from Brazil!