DEV Community

Cover image for Learn Python: Numbers
Rishi
Rishi

Posted on • Updated on

Learn Python: Numbers

Numbers

Integer

i_am_an_integer = 2020 
print(i_am_an_integer)

Float

i_am_a_float = 20.123456  
print(i_am_a_float)

Arthmetic Operations

maths_operation = 6 + 5 - 4 * 3 / 2
print(maths_operation)

Division

Division always returns a float.

float_division = 48 / 2 
print(float_division);


float_division2 = 49 / 3 
print(float_division2);

Integer Division

To do integer division, we must use: //.

integer_division = 50 // 2 
print(integer_division);


integer_division2 = 49 // 3 
print(integer_division2);

Modulus | Remainder

remainder = 17 % 5;
print(remainder)



Top comments (0)