91.1k views
3 votes
Write the definition of a function that take one number, that represents a temperature in Fahrenheit and prints the equivalent temperature in degrees Celsius.

User DomQ
by
6.0k points

1 Answer

1 vote

Answer:

Follows are the method definition to this question:

def Temperature(f):#defining a method Temperature that accept a variable f

c= 5*(f-32)/9#use formula to convert Fahrenheit into Celsius

print(c,"degree Celsius")#print Celsius value

f=float(input("Enter Temperature in Fahrenheit: "))#defining f variable for input the value

Temperatures(f)#calling the method

Output:

Enter Temperature in Fahrenheit: 104

40.0 degree Celsius

Step-by-step explanation:

In the above-given code, a method "Temperature" is declared, that accepts an "f" variable in its parameter, and inside the method, a formula is used that converts a Fahrenheit into degree Celsius and use the print method to print its calculated value.

In the next step, an "f" variable is defined, which uses the input method to take value from the user and pass the value into the method.

User Marwen Trabelsi
by
5.6k points