module-assessment-arrays-matrices.rst
author Nishanth <nishanth@fossee.in>
Wed, 06 Oct 2010 16:15:42 +0530
changeset 221 7cd975ff5f0d
parent 157 a1111c1815f6
permissions -rw-r--r--
Added questions

========
 Script
========

Welcome. 

This spoken tutorial is a self-assessment tutorial and you will be
able to assess yourself on the concepts learnt in the Module on Arrays
and Matrices. 


As with all other assessments we will first start with a few short
questions that will not take you more that 15 to 20 seconds to
answer. Then we shall move on to a bigger problem, that you are
expected to solve in less than 10 mins. 


  * Given a list of marks::
   
      marks = [10, 20, 30, 50, 55, 75, 83]

    How will you convert it to an array?

  * What is the shape of the following array?::

      x = array([[1,2,3,4],
                 [3,4,2,5]])

  * What is the resulting array::

      a = array([[1, 2],
                 [3, 4]])
      
      a[1,0] = 0
 
  * What is the resulting array?::

      x = array(([1,2,3,4],
                 [2,3,4,5]))

      x[-2][-3] = 4


  * How do we change the array ``x = array([[1,2,3,4]])`` to
    ``array([[1,2,0,4]])``?

  * How do we get the slice::

      array([[2,3],
             [4,2]])

    out of the array::

      x = array([[1,2,3,4],
                 [3,4,2,5]])


  * What is the output of x[::3,::3], when x is::

      x = array([[9,18,27],
                 [30,60,90],
                 [14,7,1]])

  * How do you get the transpose of this array?::

      a = array([[1, 2],
                 [3, 4]])

  * What is the output of the following?::

      a = array([[1, 2],
                 [3, 4]])

      b = array([[1, 1],
                 [2, 2]])

      a*b


{{{ show slides with solutions to these problems }}}

Now, let us move on to a larger problem. From the image
`tagore-einstein.png``

  + extract the face of Einstein alone.
  + extract the face of Tagore alone.
  + get a smaller copy of the image, that is a fourth it's size. 
                 

{{{ show slide with solutions to the problem }}}

Thank You!