# HG changeset patch # User Puneeth Chaganti # Date 1286434704 -19800 # Node ID 62cb96a8f6b956aa3fc4685c97cad6ffb9ddbef4 # Parent a33e942379d731aa611b7dccab1df31f2f6fdb2b# Parent e78c284d644ba382eab00a7bc848b56ab32b44dc Merged heads. diff -r e78c284d644b -r 62cb96a8f6b9 accessing-pieces-arrays/script.rst --- a/accessing-pieces-arrays/script.rst Thu Oct 07 10:57:15 2010 +0530 +++ b/accessing-pieces-arrays/script.rst Thu Oct 07 12:28:24 2010 +0530 @@ -1,22 +1,21 @@ .. Objectives .. ---------- - By the end of this tutorial, you will be able to: + .. By the end of this tutorial, you will be able to: - 1. Access and change individual elements of arrays, both one - dimensional and multi-dimensional. - 2. Access and change rows and columns of arrays. - 3. Access and change other chunks from an array, using slicing - and striding. - 4. Read images into arrays and perform processing on them, using - simple array manipulations. + .. 1. Access and change individual elements of arrays, both one + .. dimensional and multi-dimensional. + .. 2. Access and change rows and columns of arrays. + .. 3. Access and change other chunks from an array, using slicing + .. and striding. + .. 4. Read images into arrays and perform processing on them, using + .. simple array manipulations. .. Prerequisites .. ------------- -.. 1. Name of LO-1 -.. 2. Name of LO-2 -.. 3. Name of LO-3 +.. 1. getting started with arrays + .. Author : Puneeth Internal Reviewer : diff -r e78c284d644b -r 62cb96a8f6b9 advanced-features-functions/questions.rst --- a/advanced-features-functions/questions.rst Thu Oct 07 10:57:15 2010 +0530 +++ b/advanced-features-functions/questions.rst Thu Oct 07 12:28:24 2010 +0530 @@ -1,17 +1,108 @@ -Objective ---------- +Objective Questions +------------------- + +.. A mininum of 8 questions here (along with answers) + +1. All arguments of a function cannot have default values. True or + False? + + Answer: False + +#. When calling a function, the arguments + + 1. should always be in the order in which they are defined. + #. can be in any order + #. only keyword arguments can be in any order, but should be called + at the beginning. + #. only keyword arguments can be in any order, but should be called + at the end. -.. A mininum of 8 questions here. +#. Given the following function, identify the keywords with default + values. + :: + + def seperator(char, count=40, show=False): + + if show: + print char * count + + return char * count + + Answer: ``count``, ``show`` -1. Question 1 -2. Question 2 -3. Question 3 +#. Given the following function, + :: + + def seperator(char, count=40, show=False): + + if show: + print char * count + + return char * count + + What is the output of ``separator("+", 1, True)``. + + Answer: ``+`` is printed and returned. -Programming ------------ +#. Given the following function, + :: + + def seperator(char, count=40, show=False): + + if show: + print char * count + + return char * count + + What is the output of ``separator("+", True, 1)``. + + Answer: ``+`` is printed and returned. + +#. Given the following function, + :: + + def seperator(char, count=40, show=False): + + if show: + print char * count + + return char * count + + What is the output of ``separator("+", show=True, 1)``. + + Answer: SyntaxError -.. A minimum of 2 questions here. +#. The following is a valid function definition. True or False? Why? + :: + + def seperator(count=40, char, show=False): + + if show: + print char * count + + return char * count + + Answer: False. All parameters with default arguments should be + defined at the end. -1. Programming Assignment 1 -2. Programming Assignment 2 +#. Which of the following cannot be used as default values for + arguments? + + a. floats + #. lists + #. functions + #. booleans + #. None of the Above + + Answer: None of the above. + + +Larger Questions +---------------- + +.. A minimum of 2 questions here (along with answers) + +1. + +2. diff -r e78c284d644b -r 62cb96a8f6b9 advanced-features-functions/script.rst --- a/advanced-features-functions/script.rst Thu Oct 07 10:57:15 2010 +0530 +++ b/advanced-features-functions/script.rst Thu Oct 07 12:28:24 2010 +0530 @@ -1,17 +1,40 @@ -======== - Script -======== +.. Objectives +.. ---------- + +.. At the end of this tutorial, you will be able to + +.. 1. Assign default values to arguments, when defining functions +.. 2. Define and call functions with keyword arguments. +.. 3. Also, you will get a glimpse of the plethora of functions +.. available, in Python standard library and the scientific computing +.. libraries. + -{{{ show the welcome slide }}} +.. Prerequisites +.. ------------- + +.. 1. getting started with ipython +.. #. getting started with functions + +.. Author : Puneeth + Internal Reviewer : + External Reviewer : + Checklist OK? : [2010-10-05] + +Script +------ + +{{{ Show the slide containing title }}} Welcome to the tutorial on advanced feature of functions. -{{{ show the outline slide }}} +{{{ Show the outline slide }}} In this tutorial we shall be looking at specifying default arguments to functions when defining them and calling functions using keyword arguments. We shall also, look at some of the built-in functions -available in the standard library of Python. +available in the standard library of Python and the scientific +computing libraries. {{{ switch to terminal }}} @@ -46,7 +69,7 @@ linspace(0, 2*pi, 100) # returns 100 points between 0 and 2pi linspace(0, 2*pi) # returns 50 points between 0 and 2pi -#[punch: all above content goes on to a slide] +.. #[punch: all above content goes on to a slide] {{{ switch back to ipython }}} @@ -76,10 +99,13 @@ "Hello" is treated as the ``greet`` and we get "Hello World" as the output. "World" is the default value for the argument ``name``. -E%% %% Pause the video here and redefine the function ``welcome``, by -interchanging it's arguments. Place the ``name`` argument with it's -default value of "Hello" before the ``greet`` argument. Then, resume -the video. +Following is an (are) exercise(s) that you must do. + +%%1%% Redefine the function ``welcome``, by interchanging it's +arguments. Place the ``name`` argument with it's default value of +"Hello" before the ``greet`` argument. + +Please, pause the video here. Do the exercise and then continue. :: @@ -90,17 +116,24 @@ default argument``. When defining a function all the argument with default values should come at the end. -E%% %% Pause the video here and type ``linspace?`` to see the -definition of the command and notice how all the arguments with -default values are towards the end. +Following is an exercise that you must do. + +%%2%% See the definition of linspace using ``?`` and observe how all +the arguments with default values are towards the end. + +Please, pause the video here. Do the exercise and then continue. :: linspace? -E%% %% Pause the video here and redefine the function ``welcome`` with -a default value of "Hello" to the ``greet`` argument. Then, call the -function without any arguments. Then, resume the video. +Following is an exercise that you must do. + +%%3%% Redefine the function ``welcome`` with a default value of +"Hello" to the ``greet`` argument. Then, call the function without any +arguments. + +Please, pause the video here. Do the exercise and then continue. :: @@ -175,8 +208,8 @@ Math functions - abs, sin, .... -#[punch: Need to decide, exactly what to put here. Reviewer comments - welcome.] +.. #[punch: Need to decide, exactly what to put here. Reviewer comments +.. welcome.] {{{ switch to slide showing classes of functions in pylab, scipy }}} @@ -192,7 +225,7 @@ scipy (modules) fftpack, stats, linalg, ndimage, signal, optimize, integrate -{{{ switch slide to summary slide }}} +{{{ Show summary slide }}} That brings us to the end of this tutorial. In this tutorial we have learnt how to use functions with default values and keyword @@ -200,4 +233,9 @@ Python standard library and the Scientific Computing related packages. -Thank You! +{{{ Show the "sponsored by FOSSEE" slide }}} + +This tutorial was created as a part of FOSSEE project, NME ICT, MHRD India + +Hope you have enjoyed and found it useful. +Thank you! diff -r e78c284d644b -r 62cb96a8f6b9 getting-started-files/script.rst --- a/getting-started-files/script.rst Thu Oct 07 10:57:15 2010 +0530 +++ b/getting-started-files/script.rst Thu Oct 07 12:28:24 2010 +0530 @@ -1,10 +1,30 @@ -======== - Script -======== +.. Objectives +.. ---------- + +.. By the end of this tutorial, you will be able to +.. 1. Open and read the contents of a file. +.. #. Read files line by line. +.. #. Read all the contents of the file at once. +.. #. Close open files. + +.. Prerequisites +.. ------------- -Welcome to the tutorial on getting started with files. +.. 1. getting started with ipython +.. #. getting started with lists +.. #. getting started with for + +.. Author : Puneeth + Internal Reviewer : + External Reviewer : + Checklist OK? : [2010-10-05] -{{{ Screen shows welcome slide }}} +Script +------ + +{{{ Show the slide containing title }}} + +Hello Friends. Welcome to the tutorial on getting started with files. {{{ Show the outline for this tutorial }}} @@ -54,24 +74,29 @@ pend -%%1%% Pause the video here and split the variable into a list, -``pend_list``, of the lines in the file and then resume the -video. Hint, use the tab command to see what methods the string -variable has. +Following is an (are) exercise(s) that you must do. + +%%1%% Split the variable into a list, ``pend_list``, of the lines in +the file. Hint, use the tab command to see what methods the string +variable has. -#[punch: should this even be put? add dependency to strings LO, -where we mention that strings have methods for manipulation. hint: -use splitlines()] +Please, pause the video here. Do the exercise and then continue. + +.. #[punch: should this even be put? add dependency to strings LO, +.. where we mention that strings have methods for manipulation. hint: +.. use splitlines()] + :: pend_list = pend.splitlines() pend_list -Now, let us learn to read the file line-by-line. But, before that -we will have to close the file, since the file has already been -read till the end. -#[punch: should we mention file-pointer?] +Now, let us learn to read the file line-by-line. But, before that we +will have to close the file, since the file has already been read till +the end. + +.. #[punch: should we mention file-pointer?] Let us close the file opened into f. :: @@ -89,8 +114,11 @@ Let us, now move on to reading files line-by-line. -%%1%% Pause the video here and re-open the file ``pendulum.txt`` -with ``f`` as the file object, and then resume the video. +Following is an exercise that you must do. + +%%2%% Re-open the file ``pendulum.txt`` with ``f`` as the file object. + +Please, pause the video here. Do the exercise and then continue. We just use the up arrow until we reach the open command and issue it again. @@ -143,5 +171,11 @@ a whole, using the read command or reading it line by line by iterating over the file object. -Thank you! +{{{ Show the "sponsored by FOSSEE" slide }}} + +This tutorial was created as a part of FOSSEE project, NME ICT, MHRD India +Hope you have enjoyed and found it useful. +Thank you! + +