please help solve this python project asap you will create a python function ctemp t 5188843
Please help solve this python project ASAP
You will create a Python function, ctemp_to_ftemp, to compute a Celsius temperature to the corresponding Fahrenheit temperature. ctemp_to_ftemp will have one parameter, ctemp, a temperature in degrees Celsius.ctemp_to_ftempshould return the fahrenheit temperature, eg
[>>> ctemp_to_ftemp(100)
212.0]
The formula for converting from Celsius to Fahrenheit is:
[Celsius temperature] * 9/5 + 32
The first step for this function is to follow the program design template presented in class to create a stub function, e.g.,ctemp_to_ftemp_stub. The stub function should have
header, including parameters
docstring, with
type contract
succinct description with references to parameters and returned value
simple examples of function calls
pass statement
return statement (with comment for returned value)
When ctemp_to_ftemp_stub is “working”, make a copy and name the copyctemp_to_ftemp. Replace the pass statement with the code needed to compute the fahrenheit temperature as specified above. ctemp_to_ftemp should print correct values for the simple examples you included in your stub function, and also for the test cases given here.
[>>> ctemp_to_ftemp(30)
86.0
>>> ctemp_to_ftemp(21.1)
69.98]
What I have so far but doesnt work keeps on giving me error messages. If this is totally different from you get just let me know.
def menu():
print(“n 1. Celsius to Fahrenheit”)
print(” 2 .Exit”)
pick = int(input(“enter u r choice : “))
return pick
def tocelsius(f):
return int ((f -32) / 1.8)
def main():
choice = menu()
while choice != 2:
if choice == 1:
# convert C to F
c = eval(input(“Enter degrees celsius: “))
print(str(c) + “c = ” + str(toFahrenheit(c)) + “f”)
else:
print(“Invalid Entry”)
choice = menu()
main()