Python: Remove division decimal

Dan Alexander picture Dan Alexander · Jul 15, 2013 · Viewed 146.3k times · Source

I have made a program that divides numbers and then returns the number, But the thing is that when it returns the number it has a decimal like this:

2.0

But I want it to give me:

2

so is there anyway I can do this?

Thanks in Advance!

Answer

TerryA picture TerryA · Jul 15, 2013

You can call int() on the end result:

>>> int(2.0)
2