diff options
-rw-r--r-- | parsing_data/quickref.tex | 11 | ||||
-rw-r--r-- | parsing_data/script.rst (renamed from parsing_data.rst) | 102 | ||||
-rw-r--r-- | parsing_data/slides.tex | 106 |
3 files changed, 136 insertions, 83 deletions
diff --git a/parsing_data/quickref.tex b/parsing_data/quickref.tex new file mode 100644 index 0000000..a0212b3 --- /dev/null +++ b/parsing_data/quickref.tex @@ -0,0 +1,11 @@ +Creating a tuple:\\ +{\ex \lstinline| t = (1, "hello", 2.5)|} + +Accessing elements of tuples:\\ +{\ex \lstinline| t[index] Ex: t[2]|} + +Accessing slices of tuples:\\ +{\ex \lstinline| t[start:stop:step]|} + +Swapping values:\\ +{\ex \lstinline| a, b = b, a|} diff --git a/parsing_data.rst b/parsing_data/script.rst index 17e1d4d..5873132 100644 --- a/parsing_data.rst +++ b/parsing_data/script.rst @@ -1,7 +1,23 @@ -.. Author : Nishanth - Internal Reviewer 1 : - Internal Reviewer 2 : +.. Objectives +.. ---------- + +.. A - Students and teachers from Science and engineering backgrounds + B - + C - + D - + +.. Prerequisites +.. ------------- + +.. 1. Getting started with lists + +.. Author : Nishanth Amuluru + Internal Reviewer : External Reviewer : + Checklist OK? : <put date stamp here, if OK> [2010-10-05] + +Script +------ Hello friends and welcome to the tutorial on Parsing Data @@ -204,84 +220,4 @@ This tutorial was created as a part of FOSSEE project, NME ICT, MHRD India Hope you have enjoyed and found it useful. Thank you -Questions -========= - - 1. How do you split the string "Guido;Rossum;Python" to get the words - - Answer: line.split(';') - - 2. line.split() and line.split(' ') are same - - a. True - #. False - - Answer: False - - 3. What is the output of the following code:: - - line = "Hello;;;World;;" - sub_strs = line.split() - print len(sub_strs) - - Answer: 5 - - 4. What is the output of " Hello World ".strip() - - a. "Hello World" - #. "Hello World" - #. " Hello World" - #. "Hello World " - - Answer: "Hello World" - - 5. What does "It is a cold night".strip("It") produce - Hint: Read the documentation of strip - - a. "is a cold night" - #. " is a cold nigh" - #. "It is a cold nigh" - #. "is a cold nigh" - - Answer: " is a cold nigh" - - 6. What does int("20") produce - - a. "20" - #. 20.0 - #. 20 - #. Error - - Answer: 20 - - 7. What does int("20.0") produce - - a. 20 - #. 20.0 - #. Error - #. "20" - - Answer: Error - - 8. What is the value of float(3/2) - - a. 1.0 - #. 1.5 - #. 1 - #. Error - - Answer: 1.0 - - 9. what doess float("3/2") produce - - a. 1.0 - #. 1.5 - #. 1 - #. Error - - Answer: Error - - 10. See if there is a function available in pylab to calculate the mean - Hint: Use tab completion - diff --git a/parsing_data/slides.tex b/parsing_data/slides.tex new file mode 100644 index 0000000..df1462c --- /dev/null +++ b/parsing_data/slides.tex @@ -0,0 +1,106 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%Tutorial slides on Python. +% +% Author: FOSSEE +% Copyright (c) 2009, FOSSEE, IIT Bombay +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\documentclass[14pt,compress]{beamer} +%\documentclass[draft]{beamer} +%\documentclass[compress,handout]{beamer} +%\usepackage{pgfpages} +%\pgfpagesuselayout{2 on 1}[a4paper,border shrink=5mm] + +% Modified from: generic-ornate-15min-45min.de.tex +\mode<presentation> +{ + \usetheme{Warsaw} + \useoutertheme{infolines} + \setbeamercovered{transparent} +} + +\usepackage[english]{babel} +\usepackage[latin1]{inputenc} +%\usepackage{times} +\usepackage[T1]{fontenc} + +\usepackage{ae,aecompl} +\usepackage{mathpazo,courier,euler} +\usepackage[scaled=.95]{helvet} + +\definecolor{darkgreen}{rgb}{0,0.5,0} + +\usepackage{listings} +\lstset{language=Python, + basicstyle=\ttfamily\bfseries, + commentstyle=\color{red}\itshape, + stringstyle=\color{darkgreen}, + showstringspaces=false, + keywordstyle=\color{blue}\bfseries} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Macros +\setbeamercolor{emphbar}{bg=blue!20, fg=black} +\newcommand{\emphbar}[1] +{\begin{beamercolorbox}[rounded=true]{emphbar} + {#1} + \end{beamercolorbox} +} +\newcounter{time} +\setcounter{time}{0} +\newcommand{\inctime}[1]{\addtocounter{time}{#1}{\tiny \thetime\ m}} + +\newcommand{\typ}[1]{\lstinline{#1}} + +\newcommand{\kwrd}[1]{ \texttt{\textbf{\color{blue}{#1}}} } + +% Title page +\title{Your Title Here} + +\author[FOSSEE] {FOSSEE} + +\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay} +\date{} + +% DOCUMENT STARTS +\begin{document} + +\begin{frame} + \maketitle +\end{frame} + +\begin{frame}[fragile] + \frametitle{Outline} + \begin{itemize} + \item + \end{itemize} +\end{frame} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% All other slides here. %% +%% The same slides will be used in a classroom setting. %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\begin{frame}[fragile] + \frametitle{Summary} + \begin{itemize} + \item + \end{itemize} +\end{frame} + +\begin{frame} + \frametitle{Thank you!} + \begin{block}{} + \begin{center} + This spoken tutorial has been produced by the + \textcolor{blue}{FOSSEE} team, which is funded by the + \end{center} + \begin{center} + \textcolor{blue}{National Mission on Education through \\ + Information \& Communication Technology \\ + MHRD, Govt. of India}. + \end{center} + \end{block} +\end{frame} + +\end{document} |