Skip to content Skip to sidebar Skip to footer

Python 2.7.5 Error Printing List Of Float Numbers

I was trying to answer a question from here (Substracion of two items from two lists). The original problem has two different lists with float values and the goal is to zip them an

Solution 1:

The print method formats the float however when you print the list it doesn't format its internal values and prints as it is.

    >>> print(intervals[0])   <== formatting is done by print here
    0.44
    >>> intervals[0]
    0.4399999999999995

    >>> print (type(intervals))
    <type 'list'>
    >>> print (type(intervals[0]))
    <type 'float'>

Post a Comment for "Python 2.7.5 Error Printing List Of Float Numbers"