Advertisement
Guest User

Untitled

a guest
Jun 27th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.18 KB | None | 0 0
  1. from decimal import Decimal
  2.  
  3. # First we take a float and convert it to a decimal
  4. x = Decimal(16.0/7)
  5. print(x)
  6.  
  7. # Then we round it to 2 places
  8. output = round(x,4)
  9. print(output)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement