-3
How do I round up python 3 ? For example, the 4000/18 calculation always results in 223.
-3
How do I round up python 3 ? For example, the 4000/18 calculation always results in 223.
1
To round a number up, use python Math’s own library, along with the function Ceil
import math
print(math.ceil(4000/18))
This will result in 223
Edit: As in the comments there is an extra code should put one more line like this, after doing the split
calculo = math.ceil(calculo)
right, but in this example of code, how do I make the result of the variable calculation always result in an integer up, regardless of the other values? cost = float(input("Enter the cost of the theatrical performance, in real: ")) invitation = float(input("Enter the value of the invitation, in real: ")) calculation = cost/invitation print("For there to be no loss, must be sold: ",calculation, "invitations")
I will edit the answer
thank you very much! I got
Browser other questions tagged python float rounding
You are not signed in. Login or sign up in order to post.
I think you can find the answer to that with a simple Google search or the OS itself, don’t you? Look at this link
– Andre
@user140828 when so, you can click "Flag" and paste the link into the duplicate session. Help the question author and moderation. Not to mention that already comments automatically with the link of the question referenced.
– LipESprY