Python for Absolute Beginners Transcripts
Chapter: Cleaner code with common data structures
Lecture: Practice time
0:00 It wouldn't be the end of the chapter if you didn't have some practice exercises, not worth it. Let's see what I got on deck for you.
0:06 Here we are in our GitHub repo if we go over to practices. CH07 data structure we scroll down and see what we got.
0:13 Now, here's the sort of standard introduction we've gone through that a few times I won't it again. The core concepts I'm throwing out here
0:20 for you are creating static dictionaries and dynamic dictionaries as you can see here. We can even use some cool what
0:28 are called dictionary comprehensions. We didn't talk about those yet but they're very, very neat and you can play with them.
0:34 As well as reading values from a dictionary. So here's the deal. What you going to do in this exercise is you're going to create a dictionary
0:42 Don't care how you do it, you can create it empty and then add items to it. You can create it as a literal static dictionary.
0:48 All sorts of options are on the table here. But if you create some dictionary and call it D then this code below, you paste that code below it
0:58 you run it, it should do things like output seven when you ask for sum as your output Rock paper scissors
1:04 when you ask for roles, none for Sarah, and so on. So if you can get this output to match then you've created the right dictionary. Have fun.