2

I was writing a Python 3.5.2 program which includes division.

When I ran the following:

>>> 10/2
5.0

Though the answer is correct, it has a decimal point. What should be done to get quotient without decimal point, for example, 10/2 should yield 5, not 5.0?

jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
Steffi Keran Rani J
  • 3,667
  • 4
  • 34
  • 56

1 Answers1

0

Check out this answer. In Python 3 Integer division is performed using the // operator, and the regular division operator can yield float. Check 1/2 for example - if you get 0.5, that's not Integer division, 0 is. IDLE is irrelevant here.

Steffi Keran Rani J
  • 3,667
  • 4
  • 34
  • 56
kabanus
  • 24,623
  • 6
  • 41
  • 74