Advertisement
rfmonk

fractions_from_float.py

Jan 22nd, 2014
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.13 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3.  
  4. import fractions
  5.  
  6. for v in [0.1, 0.5, 1.5, 2.0]:
  7.     print '%s = %s' % (v, fractions.Fraction.from_float(v))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement