Created
May 8, 2018 12:45
-
-
Save Fhernd/8786a42e23535ac6918303155479e255 to your computer and use it in GitHub Desktop.
Redondear números punto flotante a una cantidad específica de decimales. OrtizOL.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
print(round(1.33, 1)) | |
print(round(1.37, 1)) | |
print(round(-1.37, 1)) | |
print(round(math.pi, 3)) | |
print(format(math.pi, '0.2f')) | |
print(format(math.pi, '0.3f')) | |
print('El valor de {} redondeado a 3 decimales es {:0.3f}'.format(math.pi, math.pi)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment