Convert Fahrenheit to Celsius
00:00
The second part of the challenge is very similar to the first one, only the other way around. So this time the function is convert_far_to_cel() with a parameter named temp_far because you need the Fahrenheit temperature as an argument when you call the function.
00:18
And then again, you can take the formula from above, but this time the parentheses are super-duper important because you need to subtract the 32 from the temp_far variable first before you multiply by 5 / 9 because of the arithmetic rules of which comes first.
00:42
Otherwise, you would multiply the 32 with 5 / 9, and you don’t want this. So first you need to separate the 32 from temp_far.
00:52
And then again you can decide if you want to put parentheses around 5 / 9 in the end and if you want to put a space in there so the slash stands alone,
01:04
and in the end, you return temp_cel.
01:09
The function looks a bit different. Only the formula inside is a different one. And when you call convert_far_to_cel() with the argument 72,
01:21
then the function returns 22.222222 and so on. So there is a similar situation like before. There are a bunch of integers after the dot, but the rounding will be tackled in one of the next lessons.
01:38
But now that you got the convert_far_to_cel() function, you can actually check the 98.6 from before.
01:46
Perfect. It converts to 37 Celsius. So the function works as expected.
Become a Member to join the conversation.
