diff options
author | Prabhu Ramachandran | 2017-02-08 22:04:31 +0530 |
---|---|---|
committer | Prabhu Ramachandran | 2017-02-08 22:04:31 +0530 |
commit | 7082f840a48d17e1aa262b2fd504f8132b1986e4 (patch) | |
tree | bd390fb2abd995c8dd26fae4a883fd6a2fd11a73 /basic_python/practice_control_flow.tex | |
parent | 34b5c2f361f7073dfacde294bc0e540368e16b00 (diff) | |
download | python-workshops-7082f840a48d17e1aa262b2fd504f8132b1986e4.tar.gz python-workshops-7082f840a48d17e1aa262b2fd504f8132b1986e4.tar.bz2 python-workshops-7082f840a48d17e1aa262b2fd504f8132b1986e4.zip |
Fix several mistakes and update practice_ds.
Diffstat (limited to 'basic_python/practice_control_flow.tex')
-rw-r--r-- | basic_python/practice_control_flow.tex | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/basic_python/practice_control_flow.tex b/basic_python/practice_control_flow.tex index 5ce053f..4fa966b 100644 --- a/basic_python/practice_control_flow.tex +++ b/basic_python/practice_control_flow.tex @@ -138,6 +138,7 @@ from __future__ import print_function \item Use a while loop to generate the numbers from 1 to 10 \item If a number divisible by 3 is found, print *** \item If a number divisible by 5 is found, print ***** + \item Otherwise just print the number \end{enumerate} \end{frame} @@ -295,7 +296,7 @@ from __future__ import print_function \begin{lstlisting} from numpy import linspace n = int(input()) - data = linspace(0, 1, n) + data = linspace(1, 2, n) for x in data: print(x) \end{lstlisting} @@ -305,7 +306,7 @@ from __future__ import print_function \begin{frame}[plain,fragile] \frametitle{\typ{for} loop over list 2} \begin{enumerate} - \item Ask the user for an list of fruits separated by a space + \item Ask the user for an list of fruits separated by a comma \item Print each fruit in a separate line \end{enumerate} For example let us say user enters \typ{apple, pear}, print @@ -365,7 +366,7 @@ from __future__ import print_function \begin{frame}[fragile,plain] \frametitle{Solution} \begin{lstlisting} - n = input() + n = int(input()) for i in range(n): for j in range(n): print(i+j, end=' ') |