From 171b9f276eaba9a04b7b6bbb60ce19a082bd91e3 Mon Sep 17 00:00:00 2001 From: Anoop Jacob Thomas Date: Thu, 21 Oct 2010 18:17:28 +0530 Subject: Reviewed script getting started with files. --- getting-started-files/script.rst | 25 ++++++++++++++++++++++++- getting-started-files/slides.tex | 14 ++++++-------- progress.org | 2 +- 3 files changed, 31 insertions(+), 10 deletions(-) diff --git a/getting-started-files/script.rst b/getting-started-files/script.rst index 5c21dcc..1a77eb8 100644 --- a/getting-started-files/script.rst +++ b/getting-started-files/script.rst @@ -15,7 +15,7 @@ .. #. getting started with for .. Author : Puneeth - Internal Reviewer : + Internal Reviewer : Anoop Jacob Thomas External Reviewer : Checklist OK? : [2010-10-05] @@ -77,6 +77,8 @@ to see more explicitly, what it contains. Following is an exercise that you must do. +.. #[[Anoop:add context switch to next slide - questions]] + %%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. @@ -87,6 +89,11 @@ Please, pause the video here. Do the exercise and then continue. .. where we mention that strings have methods for manipulation. hint: .. use splitlines()] +.. #[[Anoop: let us have it here, let us consider this as a + refresher]] + +.. #[[Anoop:add context switch to next slide - solution]] + :: pend_list = pend.splitlines() @@ -99,6 +106,10 @@ the end. .. #[punch: should we mention file-pointer?] +.. #[[Anoop: I think we can say that ``f`` is a file pointer which + points to the next line/data to be read from the file. We could + skip details.]] + Let us close the file opened into f. :: @@ -139,6 +150,9 @@ As we already know, ``line`` is just a dummy variable, and not a keyword. We could have used any other variable name, but ``line`` seems meaningful enough. +.. #[[Anoop: using dummy variable doesn't seem correct, can say line + is a variable]] + Instead of just printing the lines, let us append them to a list, ``line_list``. We first initialize an empty list, ``line_list``. :: @@ -167,6 +181,15 @@ with the newline characters. If you noticed, ``pend_list`` did not contain the newline characters, because the string ``pend`` was split on the newline characters. +.. #[[Anoop: I think we need to tell them that each line can be + stripped and appended to list to avoid the problem of newline + characters.]] + +.. #[[Anoop: I think the code that are required to be typed can be + added to the slide.]] + +.. #[[Anoop: Context switches are to be added.]] + {{{ show the summary slide }}} That brings us to the end of this tutorial. In this tutorial we diff --git a/getting-started-files/slides.tex b/getting-started-files/slides.tex index f82d946..f3e1765 100644 --- a/getting-started-files/slides.tex +++ b/getting-started-files/slides.tex @@ -1,4 +1,4 @@ -% Created 2010-10-10 Sun 17:51 +% Created 2010-10-21 Thu 14:35 \documentclass[presentation]{beamer} \usepackage[latin1]{inputenc} \usepackage[T1]{fontenc} @@ -8,6 +8,7 @@ \usepackage{float} \usepackage{wrapfig} \usepackage{soul} +\usepackage{t1enc} \usepackage{textcomp} \usepackage{marvosym} \usepackage{wasysym} @@ -40,7 +41,6 @@ showstringspaces=false, keywordstyle=\color{blue}\bfseries} - \begin{frame} \frametitle{Outline} \label{sec-1} @@ -64,12 +64,11 @@ showstringspaces=false, keywordstyle=\color{blue}\bfseries} \frametitle{Solution 1} \label{sec-3} -\lstset{language=Python} -\begin{lstlisting} +\begin{verbatim} In []: pend_list = pend.splitlines() In []: pend_list -\end{lstlisting} +\end{verbatim} \end{frame} \begin{frame} \frametitle{Question 2} @@ -81,10 +80,9 @@ In []: pend_list \frametitle{Solution 2} \label{sec-5} -\lstset{language=Python} -\begin{lstlisting} +\begin{verbatim} In []: f = open('/home/fossee/pendulum.txt') -\end{lstlisting} +\end{verbatim} \end{frame} \begin{frame} \frametitle{Summary} diff --git a/progress.org b/progress.org index 8e0c8c6..2ae5102 100644 --- a/progress.org +++ b/progress.org @@ -16,7 +16,7 @@ | 3.1 LO: | getting started with lists | 2 | Amit | | | | 3.2 LO: | getting started with =for= | 2 | Anoop | Nishanth (Done) | | | 3.3 LO: | getting started with strings | 2 | Madhu | | | -| 3.4 LO: | getting started with files | 3 | Punch | Anoop(Pending) | | +| 3.4 LO: | getting started with files | 3 | Punch | Anoop(Done) | | | 3.5 LO: | parsing data | 3 | Nishanth | Amit (Done) | | | 3.6 LO: | statistics | 2 | Amit | | | | 3.7 LO: | module level assessment | 3 | Madhu | | | -- cgit