summaryrefslogtreecommitdiff
path: root/parsing_data/slides.org
diff options
context:
space:
mode:
authorJovina2011-05-25 16:29:48 +0530
committerJovina2011-05-25 16:29:48 +0530
commit58cdb783e3e48d859cbc776373da257bf7b22cbe (patch)
tree2add894bf98e308e2080221e5dec8b2bb82f16e9 /parsing_data/slides.org
parent37051a2dc7b8c0cd47f2e91391612887c0f1adb9 (diff)
downloadst-scripts-58cdb783e3e48d859cbc776373da257bf7b22cbe.tar.gz
st-scripts-58cdb783e3e48d859cbc776373da257bf7b22cbe.tar.bz2
st-scripts-58cdb783e3e48d859cbc776373da257bf7b22cbe.zip
Modified the scripts and slides in module 2.
Diffstat (limited to 'parsing_data/slides.org')
-rw-r--r--parsing_data/slides.org67
1 files changed, 52 insertions, 15 deletions
diff --git a/parsing_data/slides.org b/parsing_data/slides.org
index 0027e86..90bbeae 100644
--- a/parsing_data/slides.org
+++ b/parsing_data/slides.org
@@ -18,7 +18,7 @@
#+LaTeX_HEADER: commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen},
#+LaTeX_HEADER: showstringspaces=false, keywordstyle=\color{blue}\bfseries}
-#+TITLE: Parsing Data
+#+TITLE:
#+AUTHOR: FOSSEE
#+EMAIL:
#+DATE:
@@ -29,18 +29,37 @@
#+OPTIONS: H:3 num:nil toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t
#+OPTIONS: TeX:t LaTeX:nil skip:nil d:nil todo:nil pri:nil tags:not-in-toc
-* Outline
- - What is meant by parsing data?
- - String operations required for parsing
- - Converting between data-types.
-* Question 1
+*
+#+begin_latex
+\begin{center}
+\vspace{12pt}
+\textcolor{blue}{\huge Parsing Data}
+\end{center}
+\vspace{18pt}
+\begin{center}
+\vspace{10pt}
+\includegraphics[scale=0.95]{../images/fossee-logo.png}\\
+\vspace{5pt}
+\scriptsize Developed by FOSSEE Team, IIT-Bombay. \\
+\scriptsize Funded by National Mission on Education through ICT\\
+\scriptsize MHRD,Govt. of India\\
+\includegraphics[scale=0.30]{../images/iitb-logo.png}\\
+\end{center}
+#+end_latex
+* Objectives
+ At the end of this tutorial, you will be able to,
+
+ - Split a string using a delimiter.
+ - Remove the whitespace around the string.
+ - Convert the datatypes of variables from one type to other.
+* Exercise 1
Split the variable line using a space as argument. Is it same as
splitting without an argument ?
* Solution 1
We see that when we split on space, multiple whitespaces are not
clubbed as one and there is an empty string everytime there are two
consecutive spaces.
-* Question 2
+* Exercise 2
What happens to the white space inside the sentence when it is
stripped?
* Solution 2
@@ -48,7 +67,7 @@
In []: a_str = " white space "
In []: a_str.strip()
#+end_src
-* Question 3
+* Exercise 3
What happens if you do =int("1.25")=
* Solution 3
It raises an error since converting a float string into integer
@@ -66,17 +85,35 @@
+ How to get rid of extra white space around
+ How to convert from one type to another
+ How to parse input data and perform computations on it
-* Thank you!
+* Evaluation
+ 1. How do you split the string "Guido;Rossum;Python" to get the words.
+
+ 2. How will you remove the extra whitespace in this sentence
+ " Hello World "
+
+ 3. What does int("20.0") produce
+
+ - 20
+ - 20.0
+ - Error
+ - "20"
+* Solutions
+ 1. line.split(';')
+
+ 2. " Hello World ".strip()
+
+ 3. Error
+*
#+begin_latex
- \begin{block}{}
+ \begin{block}{}
\begin{center}
- This spoken tutorial has been produced by the
- \textcolor{blue}{FOSSEE} team, which is funded by the
+ \textcolor{blue}{\Large THANK YOU!}
\end{center}
+ \end{block}
+\begin{block}{}
\begin{center}
- \textcolor{blue}{National Mission on Education through \\
- Information \& Communication Technology \\
- MHRD, Govt. of India}.
+ For more Information, visit our website\\
+ \url{http://fossee.in/}
\end{center}
\end{block}
#+end_latex