Lesson 3. Integer and float numbers
1/10. Integer arithmeticsWe already know the following operations which may be applied to numbers:
/always gives you a float (a floating-point real number, an object of type
From high school, you probably remember how to calculate negative powers. We want to provide an example if you don't remember: 2-3 = 1 / ( 23 ) = 0.125. Of course, Python allows you to calculate negative powers just the same way as positive ones:
print(2 ** -3).
**also returns a float when the power is negative.
Click "Run" to see what happens in output!
print(17 / 3) print(20 / 4) print(2 ** 4) print(2 ** -3)