"Hello world!"
'Hello world!'
print(42)
42
7+1
8
7.0+1
8.0
5/3
1.6666666666666667
5.0/3.0
1.6666666666666667
1/0
--------------------------------------------------------------------------- ZeroDivisionError Traceback (most recent call last) <ipython-input-15-9e1622b385b6> in <module> ----> 1 1/0 ZeroDivisionError: division by zero
0/0
--------------------------------------------------------------------------- ZeroDivisionError Traceback (most recent call last) <ipython-input-16-9ab73e148374> in <module> ----> 1 0/0 ZeroDivisionError: division by zero
0.0/0.0
--------------------------------------------------------------------------- ZeroDivisionError Traceback (most recent call last) <ipython-input-17-362e28523176> in <module> ----> 1 0.0/0.0 ZeroDivisionError: float division by zero
1 + 0.000001
1.000001
1 + 0.0000000000000001
1.0
Like we were taught in primary school, computers evaluate calculation according to the order dictated by 'Brackets (Of) Division Multiplication Addition Subtraction':
3 + 4 / 2 + 1
6.0
(3 + 4) / 2 + 1
4.5
3 + 4 / (2 + 1)
4.333333333333333
(3 + 4) / (2 + 1)
2.3333333333333335
Use brackets where necessary but try to avoid using too many as this will make your code more readable.