Hi I am doing this class and I have followed the instructions and then watched the first part of the video that comes with the course.
The requirement is -
Write a function called f_to_c that takes an input f_temp , a temperature in Fahrenheit, and converts it to c_temp , that temperature in Celsius.
It should then return c_temp .
Part two requires me to -
Let’s test your function with a value of 100 Fahrenheit.
Define a variable f100_in_celsius and set it equal to the value of f_to_c with 100 as an input.
This is what I have written
def f_to_c(f_temp):
return (f_temp - 32) * 5/9
f100_in_celsius = f_to_c(100)
print(f100_in_celsius)
This has given me the correct result however, I have not been able to It "return c_temp " as required in the first part of the question. I watched the video and it makes no mention of this `c_temp’.
Can you please explain how I should correectly return `c_temp’.
I recieved the output when changed but due tot he “return” passback the actual function still require two inputs as the def has two outputs. This being said the second input is a dummy variable if written as a call.
The variable c_temp that you name and assign within the function requires no parameter to justify its existence. It is a garden-variety function variable, lives its entire life within the function, and is “seen” nowhere outside of the function.
The only thing that is actually “returned” is a reference to the memory address where the calculated value is stored. The name c_temp is not attached to it in any way.