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

imported>Jesstess
imported>Jesstess
Line 624:
 
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:
 
<pre>
age = str(23)
print "I am ", age, "years old."
</pre>
 
 
We can right our own functions to encapsulate bits of useful work so we can reuse them. Here's how you do it:
Anonymous user