[Tutor] Unexpected result

Janet Hernandez janethcat21 at gmail.com
Fri Mar 27 15:32:47 EDT 2020


Hello my name is Janet Hernandez. I am a beginner in computer science and I have been using python to learn programming logic in my course. 

As an assignment, I was prompted to display a list of celsius to fahrenheit conversions from 1 to 15 using a while loop. However, when I ran the program, the conversion for 13 celsius to fahrenheit appeared to be 55.400000000000006, which is incorrect. All the other values were correct. I did a few trials apart from the while loop and it appears that python incorrectly calculates the product of 1.8*13, 1.8*26, 1.7*13, 1.7*26. Why is this happening? 

I have attached the python file below. Thank you.



More information about the Tutor mailing list