returning to the original mysterywhy does for in range( ) if = print ' elseprint 'is not print is not we now see that the test = produces the result false because the value to which is bound is not exactly what gets printed if we add to the end of the else clause the code print = * it prints false because during at least one iteration of the loop python ran out of significant digits and did some rounding it' not what our elementary school teachers taught usbut adding ten times does not produce the same value as multiplying by finallywhy does the code print print rather than the actual value of the variable xbecause the designers of python thought that would be convenient for users if print did some automatic rounding this is probably an accurate assumption most of the time howeverit is important to keep in mind that what is being displayed does not necessarily exactly match the value stored in the machine by the wayif you want to explicitly round floating point numberuse the round function the expression round(xnumdigitsreturns the floating point number equivalent to rounding the value of to numdigits decimal digits following the decimal point for example print round( ** will print as an approximation to the square root of does the difference between real and floating point numbers really mattermost of the timemercifullyit does not howeverone thing that is almost always worth worrying about is tests for equality as we have seenusing =to compare two floating point values can produce surprising result it is almost always more appropriate to ask whether two floating point values are close enough to each othernot whether they are identical sofor exampleit is better to write abs( - rather than = another thing to worry about is the accumulation of rounding errors most of the time things work out ok because sometimes the number stored in the computer is little bigger than intendedand sometimes it is little smaller than intended howeverin some programsthe errors will all be in the same direction and accumulate over time