python vs java

python vs java

Table of contents

In java when we perform division on integers then it gives only the integer part without rounding off the result obtained in case of that integer is not completely divisible.

for example:- 3/2 gives result 1 and -3/2 gives result -1

But in python for integer division (known as floor(//) division ) gives the result after rounding off the result to the lower side.

for example:- 3//2 gives result 1(taking from 1.5 lower value as 1) and also it gives the result -2 when -3//2 done (because of -1.5 rounding off to the nearest value as -2)

Note

According to my opinion, that is a reason that python is dynamically typed whereas java is a statistically typed language.

If anyone has a suggestion then please suggest me in the comment as soon as possible.

Thank You