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
0:01 if you didn't have some practice exercises, not worth it.
0:04 Let's see what I got on deck for you.
0:05 Here we are in our GitHub repo
0:07 if we go over to practices.
0:09 CH07 data structure
0:10 we scroll down and see what we got.
0:12 Now, here's the sort of standard introduction
0:14 we've gone through that a few times
0:16 I won't it again.
0:17 The core concepts I'm throwing out here
0:19 for you are creating static dictionaries
0:22 and dynamic dictionaries as you can see here.
0:26 We can even use some cool what
0:27 are called dictionary comprehensions.
0:29 We didn't talk about those yet
0:30 but they're very, very neat
0:31 and you can play with them.
0:33 As well as reading values from a dictionary.
0:35 So here's the deal.
0:37 What you going to do in this exercise
0:39 is you're going to create a dictionary
0:41 Don't care how you do it, you can create it
0:43 empty and then add items to it.
0:45 You can create it as a literal static dictionary.
0:47 All sorts of options are on the table here.
0:51 But if you create some dictionary and call it D
0:54 then this code below, you paste that code below it
0:57 you run it, it should do things like
1:00 output seven when you ask for sum
1:02 as your output Rock paper scissors
1:03 when you ask for roles, none for Sarah, and so on.
1:07 So if you can get this output to match
1:10 then you've created the right dictionary.
1:12 Have fun.