Boston Python workshop 2/Friday tutorial: Difference between revisions

Line 56:
==Types==
 
There's a helpful function (more on what a function is in a second) called <code>type</code> that tells you what kind of thing -- what <b>data type</b> -- Python thinks something is. We can check for ourselves that Python considers '1' and '1.0' to be different data types:
 
<pre>
Line 71:
So in this case 'type' is the name of the function, and it takes one argument; in the example we first give <code>type</code> an argument of 1 and then give it an argument of 1.0.
 
* Functions are a lot like functions in math class. You provide input to a function, and it possibly produces output. The '<code>type'</code> function takes data as an input, and produces what type of data the data is (e.g. an integer or a float) as output.
 
===Command history===
 
Stop here and try hitting the Up arrow on your keyboard. The Python <b>interpreter</b> saves a history of what you've entered, so you can arrow up to old commands and hit Return to re-run them!
 
==Variables==
Anonymous user