Advertisement
Fhernd

redondear.py

May 8th, 2018
3,746
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.26 KB | None | 0 0
  1. import math
  2.  
  3. print(round(1.33, 1))
  4. print(round(1.37, 1))
  5. print(round(-1.37, 1))
  6. print(round(math.pi, 3))
  7.  
  8. print(format(math.pi, '0.2f'))
  9. print(format(math.pi, '0.3f'))
  10.  
  11. print('El valor de {} redondeado a 3 decimales es {:0.3f}'.format(math.pi, math.pi))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement