Boston Python Workshop 3/Friday/Tutorial: Difference between revisions

Content added Content deleted
imported>Jesstess
imported>Jesstess
Line 620: Line 620:


<pre>
<pre>
x = type(5)
my_var = True
x = type(my_var)
</pre>
</pre>


Running this assigns the type of <code>my_var</code> -- a boolean -- to <code>x</code>.
Running this assigns the type of <code>5</code> -- an integer -- to <code>x</code>.


We also saw the <code>str</code> function, which returns a string representations of an objects so we can print it. For example:
We also saw the <code>str</code> function, which returns a string representations of an objects so we can print it. For example: