Topic was automatically imported from the old Question2Answer platform.
Asked By
arthurZ
Hi, I want to know how to ignore the decimals of a number. I’m not talking about rounding it.
For example (for this case):
Wrong: 8.83 = 9
Correct: 8.83 = 8
floor returns a rounded result. He asked for a result that ignores decimals and keeps the whole number. int(3.55)would return 3 while floor(3.55) would return 4
Cast a float value to an integer value, this method simply removes the number fractions, so for example int(2.7) will be equals to 2, int(.1) will be equals to 0 and int(-2.7) will be equals to -2.