Working with Python numbers
Python has counting numbers (ints) and measuring numbers (floats). You already know what these are, the ints are whole numbers, that’s why we use them for counting and floats are the ones with decimal parts — that’s why they are perfect for doing measurements.
Unlike in other languages, Python does not require you to declare the type of the number
ma = 10
mb = 0.01
mc = ma / mb
print(mc)
print('ma is type {0}'.format(type(ma)))
print('mb is type {0}'.format(type(mb)))
print('mc is type {0}'.format(type(mc)))
This program outputs the following.
ma = 10
mb = 0.01
print(type(float(ma))) // prints <class float="">
print(type(int(mb))) // prints <class int="">
If you find any corrections in the page or article, the best place to log that is in the site's GitHub repo workingdev.net/issues. To start a discussion with me, the best place to do that is via twitter @lovescaffeine