summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNishanth Amuluru2010-10-07 14:31:05 +0530
committerNishanth Amuluru2010-10-07 14:31:05 +0530
commitd97c22af85adaa1306a2c6e7b0f4c9355253722e (patch)
tree4707f7a7ee77e9e41d29dbe1817f3d67d2447b26
parent0102b6e2bcdb72874f421c1e0dd270a19331bdb2 (diff)
downloadst-scripts-d97c22af85adaa1306a2c6e7b0f4c9355253722e.tar.gz
st-scripts-d97c22af85adaa1306a2c6e7b0f4c9355253722e.tar.bz2
st-scripts-d97c22af85adaa1306a2c6e7b0f4c9355253722e.zip
Converted input_output to new template form
-rw-r--r--input_output/quickref.tex11
-rw-r--r--input_output/script.rst (renamed from input_output.rst)131
-rw-r--r--input_output/slides.tex106
3 files changed, 138 insertions, 110 deletions
diff --git a/input_output/quickref.tex b/input_output/quickref.tex
new file mode 100644
index 0000000..a0212b3
--- /dev/null
+++ b/input_output/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/input_output.rst b/input_output/script.rst
index 4af7aa0..46eaa7d 100644
--- a/input_output.rst
+++ b/input_output/script.rst
@@ -1,3 +1,24 @@
+.. Objectives
+.. ----------
+
+.. A - Students and teachers from Science and engineering backgrounds
+ B -
+ C -
+ D -
+
+.. Prerequisites
+.. -------------
+
+.. 1. Loops
+
+.. 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 Input/Output
{{{ Show the slide containing title }}}
@@ -176,113 +197,3 @@ This tutorial was created as a part of FOSSEE project, NME ICT, MHRD India
Hope you have enjoyed and found it useful.
Thankyou
-.. Author : Nishanth
- Internal Reviewer 1 :
- Internal Reviewer 2 :
- External Reviewer :
-
-Questions
-=========
-
- 1. ``a = 2.5``. What is the output of ``print "a is %d"%(a)``
-
- a. a is 2.5
- #. a is 2.0
- #. 2.0
- #. a is 2
-
- Answer: a is 2
-
- 2. What does ``print "This is", "a line ", "with spaces"`` print?
-
- a. This is a line with spaces
- #. This is a line with spaces
- #. This is a line with spaces
- #. This is a line with spaces
-
- Answer: This is a line with spaces
-
- 3. What does ``print "%2.5f"%(1.2)`` print?
-
- a. 1.2
- #. 1.20
- #. 1.20000
- #. 00001.2
-
- Answer: 1.20000
-
- 4. What is the output of the following code::
-
- for i in range(1,10,2):
- print i,
-
- Answer::
-
- 1 3 5 7 9
-
- 5. ``a = 2`` and ``b = 4.5``. What does ``print "a is %d and b is %2.1f"%(b, a)``
- print?
-
- a. a is 2 and b is 4.5
- #. a is 4 and b is 2
- #. a is 4 and b is 2.0
- #. a is 4.5 and b is 2
-
- Answer: a is 4 and b is 2.0
-
- 6. What is the prompt displayed by ``raw_input("Say something\nType here:")``
-
- Answer::
-
- Say something
- Type here:
-
- 6. What is the prompt displayed by ``raw_input("value of a is %d\nInput b
- value:"a)`` and ``a = 2.5``
-
- Answer::
-
- value of a is 2
- Input ba value:
-
- 7. ``a = raw_input()`` and user enters ``2.5``. What is the type of a?
-
- a. str
- #. int
- #. float
- #. char
-
- Answer: str
-
- 8. ``a = int(raw_input())`` and user enters ``4.5``. What happens?
-
- a. a = 4.5
- #. a = 4
- #. a = 4.0
- #. Error
-
- Answer: Error
-
- 9. ``a = raw_input()`` and user enters ``"this is a string"``. What does
- ``print a`` produce?
-
- a. 'this is a string'
- b. 'this is a string"
- c. "this is a string"
- #. this is a string
-
- Answer: "this is a string"
-
-Problems
-========
-
- 1. Answer to universe and everything. Keep taking input from user and print it
- back until the input is 42.
-
- Answer::
-
- ip = raw_input()
- while ip != "42":
- print ip
-
- 2.
diff --git a/input_output/slides.tex b/input_output/slides.tex
new file mode 100644
index 0000000..df1462c
--- /dev/null
+++ b/input_output/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}