| author | Anoop Jacob Thomas<anoop@fossee.in> |
| Sat, 18 Dec 2010 12:54:49 +0530 | |
| changeset 524 | b602b4dcc87d |
| parent 276 | 89437325b326 |
| permissions | -rw-r--r-- |
| 276 | 1 |
% Created 2010-10-10 Sun 21:00 |
2 |
\documentclass[presentation]{beamer}
|
|
|
236
33828497b5da
Converted input_output to new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
3 |
\usepackage[latin1]{inputenc}
|
|
33828497b5da
Converted input_output to new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
4 |
\usepackage[T1]{fontenc}
|
| 276 | 5 |
\usepackage{fixltx2e}
|
6 |
\usepackage{graphicx}
|
|
7 |
\usepackage{longtable}
|
|
8 |
\usepackage{float}
|
|
9 |
\usepackage{wrapfig}
|
|
10 |
\usepackage{soul}
|
|
11 |
\usepackage{textcomp}
|
|
12 |
\usepackage{marvosym}
|
|
13 |
\usepackage{wasysym}
|
|
14 |
\usepackage{latexsym}
|
|
15 |
\usepackage{amssymb}
|
|
16 |
\usepackage{hyperref}
|
|
17 |
\tolerance=1000 |
|
18 |
\usepackage[english]{babel} \usepackage{ae,aecompl}
|
|
19 |
\usepackage{mathpazo,courier,euler} \usepackage[scaled=.95]{helvet}
|
|
20 |
\usepackage{listings}
|
|
21 |
\lstset{language=Python, basicstyle=\ttfamily\bfseries,
|
|
22 |
commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen},
|
|
23 |
showstringspaces=false, keywordstyle=\color{blue}\bfseries}
|
|
24 |
\providecommand{\alert}[1]{\textbf{#1}}
|
|
|
236
33828497b5da
Converted input_output to new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
25 |
|
| 276 | 26 |
\title{I/O}
|
27 |
\author{FOSSEE}
|
|
|
236
33828497b5da
Converted input_output to new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
28 |
\date{}
|
|
33828497b5da
Converted input_output to new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
29 |
|
| 276 | 30 |
\usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent}
|
|
236
33828497b5da
Converted input_output to new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
31 |
\begin{document}
|
|
33828497b5da
Converted input_output to new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
32 |
|
| 276 | 33 |
\maketitle |
34 |
||
35 |
||
36 |
||
37 |
||
38 |
||
39 |
||
40 |
||
41 |
||
42 |
||
|
236
33828497b5da
Converted input_output to new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
43 |
\begin{frame}
|
| 276 | 44 |
\frametitle{Outline}
|
45 |
\label{sec-1}
|
|
46 |
||
47 |
\begin{itemize}
|
|
48 |
\item Showing output to the user. |
|
49 |
\item Taking input from the user. |
|
50 |
\end{itemize}
|
|
51 |
\end{frame}
|
|
52 |
\begin{frame}
|
|
53 |
\frametitle{Question 1}
|
|
54 |
\label{sec-2}
|
|
55 |
||
56 |
What happens when you do \texttt{print "x is \%d y is \%f" \%(x, y)}
|
|
|
236
33828497b5da
Converted input_output to new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
57 |
\end{frame}
|
| 276 | 58 |
\begin{frame}
|
59 |
\frametitle{Solution 1}
|
|
60 |
\label{sec-3}
|
|
|
236
33828497b5da
Converted input_output to new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
61 |
|
| 276 | 62 |
\texttt{int} value of \texttt{x} and \texttt{float} value of \texttt{y} are printed corresponding to the
|
63 |
modifiers used in the \texttt{print} statement
|
|
64 |
\end{frame}
|
|
65 |
\begin{frame}
|
|
66 |
\frametitle{Question 2}
|
|
67 |
\label{sec-4}
|
|
68 |
||
69 |
Enter the number 5.6 as input and store it in a variable called |
|
70 |
\texttt{c}.
|
|
71 |
\end{frame}
|
|
|
236
33828497b5da
Converted input_output to new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
72 |
\begin{frame}[fragile]
|
| 276 | 73 |
\frametitle{Solution 2}
|
74 |
\label{sec-5}
|
|
75 |
||
76 |
\lstset{language=Python}
|
|
77 |
\begin{lstlisting}
|
|
78 |
In []: c = raw_input() |
|
79 |
5.6 |
|
80 |
In []: c |
|
81 |
\end{lstlisting}
|
|
|
236
33828497b5da
Converted input_output to new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
82 |
\end{frame}
|
| 276 | 83 |
\begin{frame}
|
84 |
\frametitle{Question 3}
|
|
85 |
\label{sec-6}
|
|
|
236
33828497b5da
Converted input_output to new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
86 |
|
| 276 | 87 |
What happens when you do not enter anything and hit enter |
88 |
\end{frame}
|
|
89 |
\begin{frame}[fragile]
|
|
90 |
\frametitle{Solution 3}
|
|
91 |
\label{sec-7}
|
|
|
236
33828497b5da
Converted input_output to new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
92 |
|
| 276 | 93 |
\lstset{language=Python}
|
94 |
\begin{lstlisting}
|
|
95 |
In []: c = raw_input() |
|
96 |
<RET> |
|
97 |
In []: c |
|
98 |
\end{lstlisting}
|
|
99 |
\end{frame}
|
|
100 |
\begin{frame}
|
|
101 |
\frametitle{Question 4}
|
|
102 |
\label{sec-8}
|
|
103 |
||
104 |
How do you display a prompt and let the user enter input in a new line |
|
105 |
\end{frame}
|
|
|
236
33828497b5da
Converted input_output to new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
106 |
\begin{frame}[fragile]
|
| 276 | 107 |
\frametitle{Solution 4}
|
108 |
\label{sec-9}
|
|
109 |
||
110 |
\lstset{language=Python}
|
|
111 |
\begin{lstlisting}
|
|
112 |
In []: ip = raw_input("Please enter a number in the next line\n> ")
|
|
113 |
\end{lstlisting}
|
|
|
236
33828497b5da
Converted input_output to new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
114 |
\end{frame}
|
|
33828497b5da
Converted input_output to new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
115 |
\begin{frame}
|
| 276 | 116 |
\frametitle{Summary}
|
117 |
\label{sec-10}
|
|
118 |
||
119 |
You should now be able to -- |
|
120 |
\begin{itemize}
|
|
121 |
\item Print a value ``as is'' |
|
122 |
\item Print a value using using modifiers |
|
123 |
\item Accept input from user |
|
124 |
\item Display a prompt before accepting input |
|
125 |
\end{itemize}
|
|
126 |
\end{frame}
|
|
127 |
\begin{frame}
|
|
128 |
\frametitle{Thank you!}
|
|
129 |
\label{sec-11}
|
|
130 |
||
|
236
33828497b5da
Converted input_output to new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
131 |
\begin{block}{}
|
|
33828497b5da
Converted input_output to new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
132 |
\begin{center}
|
|
33828497b5da
Converted input_output to new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
133 |
This spoken tutorial has been produced by the |
|
33828497b5da
Converted input_output to new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
134 |
\textcolor{blue}{FOSSEE} team, which is funded by the
|
|
33828497b5da
Converted input_output to new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
135 |
\end{center}
|
|
33828497b5da
Converted input_output to new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
136 |
\begin{center}
|
|
33828497b5da
Converted input_output to new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
137 |
\textcolor{blue}{National Mission on Education through \\
|
|
33828497b5da
Converted input_output to new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
138 |
Information \& Communication Technology \\ |
|
33828497b5da
Converted input_output to new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
139 |
MHRD, Govt. of India}. |
|
33828497b5da
Converted input_output to new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
140 |
\end{center}
|
|
33828497b5da
Converted input_output to new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
141 |
\end{block}
|
|
33828497b5da
Converted input_output to new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
142 |
\end{frame}
|
|
33828497b5da
Converted input_output to new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
143 |
|
|
33828497b5da
Converted input_output to new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
144 |
\end{document}
|