Rounding up

Asked

Viewed 419 times

0

I have the following list of dictionaries and the values correspond to the average value , for example, in the first appears 4 , but in fact of the 4.6666. I’d like to know how and what it does , I tried with the round , but it’s the same.

[{'Nome do Dono': 'Eva', 'Media de Idade': 4}, {'Nome do Dono': 'Ana', 'Media de Idade': 53}, {'Nome do Dono': 'Ada', 'Media de Idade': 12}]
  • Can you be more specific(a) about the problem? How do you know it’s not working? Get an error? If so, paste the error message here. Get an unexpected output? If yes, put the expected output and the received output.

1 answer

0


import math
valor = 4.6666
valor_arredondado = math.ceil(valor)
print valor_arredondado # 5.0

Browser other questions tagged

You are not signed in. Login or sign up in order to post.