Jul-09-2020, 05:26 AM
Because float will convert "4" to 4.0, which is a float. On the other hand, you simply can't have an integer with a value of 4.1, hence it fails.
You could try stuff like rounding off or truncating before passing a float value to the int() function.
You could try stuff like rounding off or truncating before passing a float value to the int() function.