Python Forum
My first temperature converter
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
My first temperature converter
#2
I don't see a question, but your answers will be wrong.
You are assuming calculations occur left to right. That is true of things at the same order of precedence, but not everything.

In brief - addition and subtraction at same level
Multiplication and division a level above
Exponentiation a level above that
Parentheses a level above that

So, line 27 will calculate 32*5/9, subtract that from fah and then add 273. Wrong answer. Proper format would be
return (fah - 32) * 5/9 + 273.15
The same type of error is repeated in lines 24 and 33.
Reply


Messages In This Thread
My first temperature converter - by TheLowEndTheory - Oct-17-2020, 07:47 PM
RE: My first temperature converter - by jefsummers - Oct-17-2020, 08:07 PM
RE: My first temperature converter - by Yoriz - Oct-17-2020, 10:41 PM
RE: My first temperature converter - by buran - Oct-18-2020, 06:53 AM
RE: My first temperature converter - by buran - Oct-18-2020, 04:39 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Temperature converter Help (ASAP) Edison_Weng 1 2,791 Apr-16-2018, 01:55 PM
Last Post: stranac
  how to get the highest monthly average temperature? nikhilkumar 2 6,949 Jul-25-2017, 02:33 PM
Last Post: DeaD_EyE
  Using a range and for loop - temp converter rattlerskin 5 15,575 Jan-20-2017, 09:15 PM
Last Post: sparkz_alot
  Temp Converter with Kelvin vader33 7 12,052 Oct-02-2016, 05:16 AM
Last Post: vader33

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020