1
00:00:07,970 --> 00:00:10,875
So, let's go over some questions.

2
00:00:10,875 --> 00:00:13,710
So, this is a true false boolean.

3
00:00:13,710 --> 00:00:19,335
So, true false a dictionary is an unordered collection of key value pairs,

4
00:00:19,335 --> 00:00:21,960
that is absolutely true.

5
00:00:21,960 --> 00:00:24,615
That is what a dictionary is.

6
00:00:24,615 --> 00:00:27,075
Then we have a multiple choice.

7
00:00:27,075 --> 00:00:29,340
What's printed by the following statement.

8
00:00:29,340 --> 00:00:35,280
So, here we declare a dictionary with three key value pairs cat, dog, elephant.

9
00:00:35,280 --> 00:00:39,790
And then we print out my dictionary sub dog.

10
00:00:39,790 --> 00:00:43,055
So, the value of this expression is,

11
00:00:43,055 --> 00:00:48,350
whatever value is associated with the key dog in my dictionary.

12
00:00:48,350 --> 00:00:50,825
So, in order to answer this question,

13
00:00:50,825 --> 00:00:54,080
we have to look at what's associated with this key dog.

14
00:00:54,080 --> 00:00:57,335
We find the key value pair for dog here,

15
00:00:57,335 --> 00:01:01,445
and we see that the value associated with the key dog is six.

16
00:01:01,445 --> 00:01:05,250
So, we should expect six to be printed out.

17
00:01:07,070 --> 00:01:09,980
Then this question asks us to create

18
00:01:09,980 --> 00:01:13,415
a dictionary that keeps track of the USA's Olympic medal count.

19
00:01:13,415 --> 00:01:16,340
Each key of the dictionary should be the type of metal;

20
00:01:16,340 --> 00:01:19,010
so gold, silver or bronze,

21
00:01:19,010 --> 00:01:24,860
and each key's value should be the number of that type of metal that the USA has won.

22
00:01:24,860 --> 00:01:28,175
So currently, the US has 33 gold,

23
00:01:28,175 --> 00:01:32,065
17 silver and 12 bronze.

24
00:01:32,065 --> 00:01:35,715
So again, the keys here should be gold, silver and bronze,

25
00:01:35,715 --> 00:01:38,300
and the values associated with those keys should be

26
00:01:38,300 --> 00:01:41,705
the number of the medal that the US has won.

27
00:01:41,705 --> 00:01:46,975
Then they want us to create that dictionary and save it in the variable medals.

28
00:01:46,975 --> 00:01:48,930
So in the code,

29
00:01:48,930 --> 00:01:55,290
I'm going to say medals equals a dictionary.

30
00:01:55,290 --> 00:01:57,265
So, I'll use curly braces,

31
00:01:57,265 --> 00:02:03,110
and first I want to have the key gold associated with the value 33.

32
00:02:03,110 --> 00:02:07,760
If I just typed gold 33 which is common to do,

33
00:02:07,760 --> 00:02:09,925
then I would actually get an air,

34
00:02:09,925 --> 00:02:14,090
because when I say gold it's looking for your variable called gold.

35
00:02:14,090 --> 00:02:17,690
Instead I want to make this key a string.

36
00:02:17,690 --> 00:02:24,265
So, I want the string gold to be associated with the value integer 33.

37
00:02:24,265 --> 00:02:26,010
Same thing with silver.

38
00:02:26,010 --> 00:02:30,750
So, silver is associated with the value 17,

39
00:02:30,750 --> 00:02:36,090
and bronze is associated with the value 12.

40
00:02:36,090 --> 00:02:38,625
So, here I just got each of these.

41
00:02:38,625 --> 00:02:44,625
So, 12,17 and 33 from the problem statement.

42
00:02:44,625 --> 00:02:46,860
So, now when I run my code,

43
00:02:46,860 --> 00:02:49,690
then I should see that it parses.

44
00:02:51,290 --> 00:02:54,100
So, this question is very similar.

45
00:02:54,100 --> 00:02:56,680
Here we are told you're keeping track of Olympic medals

46
00:02:56,680 --> 00:02:59,740
for Italy in the 2016 Rio Summer Olympics.

47
00:02:59,740 --> 00:03:02,560
At the moment Italy has seven gold,

48
00:03:02,560 --> 00:03:06,400
eight silver and six bronze metals.

49
00:03:06,400 --> 00:03:10,540
Create a dictionary called Olympics where the keys are the type of

50
00:03:10,540 --> 00:03:15,640
medal and the values are the number of that type of medal that Italy has won so far.

51
00:03:15,640 --> 00:03:17,335
So, exact same idea,

52
00:03:17,335 --> 00:03:20,590
I'm going to say Olympics equals,

53
00:03:21,360 --> 00:03:24,280
and then we want to assign that to be a dictionary,

54
00:03:24,280 --> 00:03:25,720
so, we use curly braces.

55
00:03:25,720 --> 00:03:27,790
We have three key-value pairs.

56
00:03:27,790 --> 00:03:33,945
So, we have gold associated with the value seven,

57
00:03:33,945 --> 00:03:37,100
then just for the sake of writing this out slightly differently,

58
00:03:37,100 --> 00:03:46,330
I'm going to set silver on the next line by saying Olympics sub silver equals eight.

59
00:03:46,330 --> 00:03:52,745
So, this is going to add a new key value pair associating silver with the value eight.

60
00:03:52,745 --> 00:04:03,025
And then I need to also say Olympics sub bronze equals six.

61
00:04:03,025 --> 00:04:05,990
So, here I just did something slightly different,

62
00:04:05,990 --> 00:04:10,820
I could have added three value pairs right in here like I did for the previous problem,

63
00:04:10,820 --> 00:04:14,660
but I could also just set the key value pairs using

64
00:04:14,660 --> 00:04:19,445
an assignment statement like I did on lines two or on lines three.

65
00:04:19,445 --> 00:04:21,695
Again, the keys are all strings,

66
00:04:21,695 --> 00:04:24,290
so here I'm using double quotes to create the string,

67
00:04:24,290 --> 00:04:25,880
here I'm using single quotes,

68
00:04:25,880 --> 00:04:28,915
but the effect is that we have three key-value pairs,

69
00:04:28,915 --> 00:04:30,405
all the keys are strings.

70
00:04:30,405 --> 00:04:31,940
So, gold, silver and bronze.

71
00:04:31,940 --> 00:04:36,660
All the values are integers seven, eight and six.

72
00:04:37,990 --> 00:04:41,820
That's all for now until next time.