Please help solve this python project. You will create a Python function, ctemp_
ID: 3661591 • Letter: P
Question
Please help solve this python project.
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_ftemp should return the fahrenheit temperature,
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 copy ctemp_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.
Explanation / Answer
Program :
#temp conversion
def menu():
print(" 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()
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.