From 1a20ef158f56a7fc6772bc4758ba999a32852b11 Mon Sep 17 00:00:00 2001 From: Medini Kadam Date: Mon, 2 May 2011 11:12:32 +0530 Subject: Reviewed the script 'Advanced features of functions'. --- advanced_features_of_functions/script.rst | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/advanced_features_of_functions/script.rst b/advanced_features_of_functions/script.rst index a420721..a649f93 100644 --- a/advanced_features_of_functions/script.rst +++ b/advanced_features_of_functions/script.rst @@ -39,8 +39,7 @@ computing libraries. {{{ switch to terminal }}} -We have an ``ipython`` terminal open, which we shall be using through -out this session. +Open the ipython terminal. To invoke ipython interpreter type ipython -pyab. Let's use the ``round`` function as an example to understand what a default value of an argument means. Let's type the following @@ -72,12 +71,18 @@ being 0. 0 is the default value of the argument. s.strip() # strips on spaces. s.strip('@') # strips the string of '@' symbols. +Thus it can be said that here blank space is the default argument. + plot(x, y) # plots with x vs. y using default line style. plot(x, y, 'o') # plots x vs. y with circle markers. +Hence, here when third argument is not provided, it shows default line style. + linspace(0, 2*pi, 100) # returns 100 points between 0 and 2pi linspace(0, 2*pi) # returns 50 points between 0 and 2pi +Hence, the default for the third argument is 50. + .. #[punch: all above content goes on to a slide] {{{ switch back to ipython }}} @@ -108,7 +113,7 @@ Now let us call the function with just one argument "Hello". "Hello" is treated as the ``greet`` and we get "Hello World" as the output. "World" is the default value for the argument ``name``. -Following is an (are) exercise(s) that you must do. +Pause the video and solve this exercise. Resume the video after you solve this. {{{ switch to next slide, containing problem statement of question 1 }}} @@ -133,7 +138,7 @@ default values should come at the end. .. #[[Anoop: In the slide, "when defining a function all the default arguments must be defined at the end" has to be emphasized"]] -Following is an exercise that you must do. +Pause the video and solve this exercise. Resume the video after you solve this. {{{ switch to next slide, containing the problem statement of question 2 }}} @@ -149,7 +154,7 @@ Please, pause the video here. Do the exercise and then continue. linspace? -Following is an exercise that you must do. +Pause the video and solve this exercise. Resume the video after you solve this. {{{ switch to next slide, problem statement }}} -- cgit From 338807195f7c7dea9c2eab603f97ffc2ac20b201 Mon Sep 17 00:00:00 2001 From: Medini Kadam Date: Mon, 2 May 2011 12:29:03 +0530 Subject: Reviewed the script 'Getting started with arrays'. --- getting_started_with_arrays/script.rst | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/getting_started_with_arrays/script.rst b/getting_started_with_arrays/script.rst index 24df387..c610e8f 100644 --- a/getting_started_with_arrays/script.rst +++ b/getting_started_with_arrays/script.rst @@ -7,8 +7,8 @@ .. #. Create arrays from lists .. #. Basic array operations .. #. Creating identity matrix using ``identity()`` function. -.. #. Learn about ``zeros()``, ``zeros_like()``, ``ones()``, - ``ones_like()`` functions. +.. #. Use functions zeros(), zeros_like(), ones(), ones_like(). +.. #. Perform basic operations with arrays. .. Prerequisites .. ------------- @@ -85,8 +85,8 @@ To create an array we will use the function ``array()`` as, Notice that we created a one dimensional array here. Also notice the object we passed to create an array. We passed a list to create an array. -Now let us see how to create a two dimensional array. Pause here and try to -do it yourself before looking at the solution. +Now let us see how to create a two dimensional array. Pause the video and try to +solve this. After you solve resume the video to look at the solution. {{{ switch to next slide, creating two dimensional arrays }}} @@ -142,9 +142,8 @@ as, {{{ switch to next slide, creating array from list}}} -Now, let us see how to convert a list object to an array. As you have -already seen, in both of the previous statements we have passed a list, so -creating an array can be done so, first let us create a list ``l1`` +Now, let us see how to convert a list object to an array. We define a list +l1 = [1,2,3,4]. To convert l1 into a array use an array command. say a3 = array(l1) :: @@ -156,6 +155,7 @@ Now we can convert the list to an array as, a3 = array(l1) +Pause the video. Solve the exercise on your terminal and resume the video once done {{{ switch to the next slide, problem statement of unsolved exercise 1 }}} @@ -181,7 +181,8 @@ check the shape of the arrays we have created so far, {{{ switch to the next slide, unsolved exercise 2 }}} -Find out the shape of the other arrays that we have created. +Pause the video and Find out the shape of the other +arrays i.e. a1, a3, ar that we have created. .. #[Puneeth: solution missing.] -- cgit From c105a0c530b04bba0b2d6770a03700a4230c4ecc Mon Sep 17 00:00:00 2001 From: pritam09 Date: Mon, 2 May 2011 00:18:47 -0700 Subject: Some minor changes to Additional features of ipython --- additional_features_of_ipython/script.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/additional_features_of_ipython/script.rst b/additional_features_of_ipython/script.rst index 0b79cc6..7d907d7 100644 --- a/additional_features_of_ipython/script.rst +++ b/additional_features_of_ipython/script.rst @@ -30,7 +30,7 @@ Hello friends and welcome to the tutorial on Additional Features of IPython {{{ Show the slide containing the outline slide }}} In this tutorial, we shall look at additional features of IPython that help us -to retreive the commands that we type on the interpreter and then save them +to retrieve the commands that we type on the interpreter and then save them into a file and run it. Let us start ipython with pylab loaded, by typing @@ -58,7 +58,7 @@ xsin(x) is actually x * sin(x) title("x and xsin") We now have the plot. Let us look at the commands that we have typed in. The -history can be retreived by using =%hist= command. Type +history can be retrieved by using =%hist= command. Type :: %hist @@ -71,7 +71,7 @@ Please note that there is a % sign before the hist command. This implies that Python interpreter. These type of commands are called as magic commands. Also note that, the =%hist= itself is a command and is displayed as the most -recent command. We should not that anything we type in is stored as history, +recent command. We should note that anything we type in is stored as history, irrespective of whether it is command or an error or IPython magic command. If we want only the recent 5 commands to be displayed, we pass the number as an argument @@ -204,9 +204,9 @@ We see that it raises NameError saying that the name linspace is not found. This brings us to the end of the tutorial. we have looked at - * Retreiving history using =%hist= command - * Vieweing only a part of history by passing an argument to %hist - * saving the required lines of code in required order using %save + * Retrieving history using =%hist= command + * Viewing only a part of history by passing an argument to %hist + * Saving the required lines of code in required order using %save * using %run -i command to run the saved script {{{ Show the "sponsored by FOSSEE" slide }}} -- cgit