diff options
-rw-r--r-- | additional_ipython/quickref.tex | 11 | ||||
-rw-r--r-- | additional_ipython/script.rst (renamed from additional_ipython.rst) | 142 | ||||
-rw-r--r-- | additional_ipython/slides.tex | 106 |
3 files changed, 134 insertions, 125 deletions
diff --git a/additional_ipython/quickref.tex b/additional_ipython/quickref.tex new file mode 100644 index 0000000..a0212b3 --- /dev/null +++ b/additional_ipython/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/additional_ipython.rst b/additional_ipython/script.rst index d60d630..1a00973 100644 --- a/additional_ipython.rst +++ b/additional_ipython/script.rst @@ -1,13 +1,23 @@ -.. Author : Nishanth - Internal Reviewer 1 : - Internal Reviewer 2 : - External Reviewer : +.. Objectives +.. ---------- -.. Prerequisites: Embellinshing plots +.. A - Students and teachers from Science and engineering backgrounds + B - + C - + D - -Script -====== +.. Prerequisites +.. ------------- + +.. 1. Embellishing Plots + +.. 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 Additional Features of IPython @@ -202,121 +212,3 @@ This tutorial was created as a part of FOSSEE project, NME ICT, MHRD India Hope you have enjoyed and found it useful. Thankyou -Questions -========= - - 1. How do you retrieve the recent 5 commands - - a. ``%hist`` - #. ``%hist -5`` - #. ``%hist 5`` - #. ``%hist 5-10`` - - Answer: ``%hist 5`` - - 2. If there were 20 commands typed and ``%hist`` is used. How many commands - will be displayed. - - a. 10 - #. 20 - #. 21 - #. 19 - - Answer: 21 - - 3. is ``%hist`` considered as a command - - a. True - #. False - - Answer: True - - 4. how do you retreive the commands from 20 to 50 (inclusive of 20 and 50) - - a. ``%hist 20 50`` - #. ``%hist 19 50`` - #. ``%hist 19 51`` - #. ``%hist 21 50`` - - Answer: ``%hist 20 50`` - - 5. What does the ``%hist 2 5 7`` command do - - a. lists the second, fifth and seventh commands - #. lists the commands from 2 to 5 and the seventh command - #. raises an error - #. lists the commands 2 to 7 - - Answer: raises an error - - 6. How many commands are displayed when lot of coomands were typed and - ``%hist`` is used. - - a. 20 - #. 10 - #. 50 - #. 40 - - Answer: 40 - - 7. How do you save the lines 2 3 4 5 7 9 10 11 - - a. ``%save filepath 2-5 7 9-11`` - #. ``%save filepath 2-11`` - #. ``%save filepath`` - #. ``%save 2-5 7 9 10 11`` - - Answer: ``%save filepath 2-5 7 9-11`` - - 8. You are working in /home/user. Where is the file saved when you do - ``%save hello.py 1-3`` - - a. /home/user/hello.py - #. /hello.py - #. /home/hello.py - #. /home/user/ipython/hello.py - - Answer: /home/user/hello.py - - 9. Which lines are saved by the command ``%save filepath 2-5 7 1`` and in - which order - - a. 2 3 4 5 7 1 - #. 1 2 3 4 5 6 7 - #. 2 5 7 1 - #. 1 2 5 7 - - 10. What happens when ``%save filepath line_numbers`` is used and a file - already exists in that path. - - a. It is overwritten - #. The commands are added to the file - #. It raises an error - #. A prompt to confirm overwriting is displayed - - Answer: A prompt to confirm overwriting is displayed - - 11. Read through the documentation of ``%hist`` and find its alternative name - - Answer: ``%history`` - - 12. Are ``%run /home/user/saved.py`` and ``%run /home/user/saved`` the same - - a. Yes - #. No - - Answer: Yes - - 13. The file hello.py contains only one command ``x = x + 1``. What happens - when you do ``%run hello.py`` - - Answer: Raises a nameerror - - 14. The file hello.py contains only one command ``x = x + 1``. If value of x - is 5 and what does ``%run -i hello.py`` do. - - a. raises an error - #. increments value of x by 1 - #. Does nothing - - Answer: increments the value of x by 1 diff --git a/additional_ipython/slides.tex b/additional_ipython/slides.tex new file mode 100644 index 0000000..df1462c --- /dev/null +++ b/additional_ipython/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} |