day2/cheatsheet1.tex
changeset 330 46533051b9d3
parent 329 0a6ab1d81491
child 346 e9961fb16c58
equal deleted inserted replaced
329:0a6ab1d81491 330:46533051b9d3
   106   \begin{lstlisting}
   106   \begin{lstlisting}
   107 In []: x, y = 1, 1.234 #initializing two variables
   107 In []: x, y = 1, 1.234 #initializing two variables
   108 In []: 'x is %s, y is %s' %(x, y)
   108 In []: 'x is %s, y is %s' %(x, y)
   109 Out[]: 'x is 1, y is 1.234'
   109 Out[]: 'x is 1, y is 1.234'
   110   \end{lstlisting}
   110   \end{lstlisting}
   111 \textbf{Note:} \typ{\%s} used in above fomatting specifies \typ{'str'} representation of variables. One can also try:\\
   111 \textbf{Note:} \typ{\%s} used in above formatting specifies \typ{'str'} representation of variables. One can also try:\\
   112 \typ{\%d} for \typ{int} representation\\
   112 \typ{\%d} for \typ{int} representation\\
   113 \typ{\%f} for \typ{float} representation
   113 \typ{\%f} for \typ{float} representation
   114 \begin{lstlisting}
   114 \begin{lstlisting}
   115 In []: 'x is %f, y is %f' %(x, y)
   115 In []: 'x is %f, y is %f' %(x, y)
   116 Out[]: 'x is 1.000000, y is 1.234000'
   116 Out[]: 'x is 1.000000, y is 1.234000'