Anonymous user
Boston Python Workshop 3/Data types: Difference between revisions
→Numbers: integers and floats
imported>Jesstess |
imported>Jesstess |
||
Line 3:
* Integers don't have a decimal place.
* Floats have a decimal place.
* Math mostly works the way it does on a calculator, and you can use parentheses to override the order of operations.
<pre>▼
>>> type(1)▼
<type 'int'>▼
>>> type(1.0)▼
<type 'float'>▼
</pre>▼
====Math: addition, subtraction, multiplication====
Line 33 ⟶ 27:
>>> float(1) / 2
0.5
▲</pre>
====Types====
▲<pre>
▲>>> type(1)
▲<type 'int'>
▲>>> type(1.0)
▲<type 'float'>
</pre>
|