Ads Here

Thursday, October 12, 2017

Arithmetic and float!

What you are going to learn.


  1. How to do basic arithmethic in Python.
  2. Learn about the Modulo operation.
  3. Learn about the Float variable type.
  4. Learn a key difference between Python 2 and Python 3

>>> 2 + 3
5
>>> 100 - 20
80
>>> 100 + 20 - 80
40
>>> 2 * 2
4
>>> 2*2
4
>>> 2 * 2
4
>>> 2 / 4
0.5
>>> 10/5
2.0
>>> 1/2
0.5
>>> type(2)
<class 'int'>
>>> type(0.5)
<class 'float'>
>>> 5 % 3
2
>>> 



No comments:

Post a Comment