Dividing two numbers

suggest change

When dividing two numbers pay attention to the type you want in return. Note that dividing two integers will invoke the integer division. If your goal is to run the float division, at least one of the parameters should be of float type.

Integer division:

3 / 2 # => 1

Float division

3 / 3.0 # => 1.0

16 / 2 / 2    # => 4
16 / 2 / 2.0  # => 4.0
16 / 2.0 / 2  # => 4.0
16.0 / 2 / 2  # => 4.0

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents