Skip to content

Instantly share code, notes, and snippets.

@lamalex
Created October 16, 2020 22:44
Show Gist options
  • Save lamalex/5690235ab00f414fc6fdfadbce960929 to your computer and use it in GitHub Desktop.
Save lamalex/5690235ab00f414fc6fdfadbce960929 to your computer and use it in GitHub Desktop.
Quick function to always print 4 decimal places
def print_precision_4(x: float):
print(f'{x:.4f}')
print_precision_4(123.12345678)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment