|
1 ======== |
|
2 Script |
|
3 ======== |
|
4 |
|
5 Welcome. |
|
6 |
|
7 This spoken tutorial is a self-assessment tutorial and you will be |
|
8 able to assess yourself on the concepts learnt in the Module on Arrays |
|
9 and Matrices. |
|
10 |
|
11 |
|
12 As with all other assessments we will first start with a few short |
|
13 questions that will not take you more that 15 to 20 seconds to |
|
14 answer. Then we shall move on to a bigger problem, that you are |
|
15 expected to solve in less than 10 mins. |
|
16 |
|
17 |
|
18 * Given a list of marks:: |
|
19 |
|
20 marks = [10, 20, 30, 50, 55, 75, 83] |
|
21 |
|
22 How will you convert it to an array? |
|
23 |
|
24 * What is the shape of the following array?:: |
|
25 |
|
26 x = array([[1,2,3,4], |
|
27 [3,4,2,5]]) |
|
28 |
|
29 * What is the resulting array:: |
|
30 |
|
31 a = array([[1, 2], |
|
32 [3, 4]]) |
|
33 |
|
34 a[1,0] = 0 |
|
35 |
|
36 * What is the resulting array?:: |
|
37 |
|
38 x = array(([1,2,3,4], |
|
39 [2,3,4,5])) |
|
40 |
|
41 x[-2][-3] = 4 |
|
42 |
|
43 |
|
44 * How do we change the array ``x = array([[1,2,3,4]])`` to |
|
45 ``array([[1,2,0,4]])``? |
|
46 |
|
47 * How do we get the slice:: |
|
48 |
|
49 array([[2,3], |
|
50 [4,2]]) |
|
51 |
|
52 out of the array:: |
|
53 |
|
54 x = array([[1,2,3,4], |
|
55 [3,4,2,5]]) |
|
56 |
|
57 |
|
58 * What is the output of x[::3,::3], when x is:: |
|
59 |
|
60 x = array([[9,18,27], |
|
61 [30,60,90], |
|
62 [14,7,1]]) |
|
63 |
|
64 * How do you get the transpose of this array?:: |
|
65 |
|
66 a = array([[1, 2], |
|
67 [3, 4]]) |
|
68 |
|
69 * What is the output of the following?:: |
|
70 |
|
71 a = array([[1, 2], |
|
72 [3, 4]]) |
|
73 |
|
74 b = array([[1, 1], |
|
75 [2, 2]]) |
|
76 |
|
77 a*b |
|
78 |
|
79 |
|
80 {{{ show slides with solutions to these problems }}} |
|
81 |
|
82 Now, let us move on to a larger problem. From the image |
|
83 `tagore-einstein.png`` |
|
84 |
|
85 + extract the face of Einstein alone. |
|
86 + extract the face of Tagore alone. |
|
87 + get a smaller copy of the image, that is a fourth it's size. |
|
88 |