I'm working on a system which doesn't have the math
module available. All "Math" functions installed (math.ceil()
, math.round()
, etc all produce errors).
I have even tried using import math
which yields:
<type 'ImportError'>
__import__ not found
Current issue that is stumping me: How can I make a math calculation round up to a whole number without math.ceil
?
x - int(x)
is greater than 0? So something likeint(x) + (1 if x - int(x) > 0 else 0)
– Worldlyint(x//1) + 1
? – Renshawx
is already an integer. – Worldlyx if isinstance(x, int) else int(x//1) + 1
or use the answer from @Rory Daulton – Renshaw