programming-examples/python/Math/Split fractional and integer parts of a floating point number.py

4 lines
129 B
Python
Raw Permalink Normal View History

2019-11-15 12:59:38 +01:00
import math
print(' (F) (I)')
for i in range(6):
print('{}/2 = {} {}'.format(i, i/2, math.modf(i/2.0)))