step by step in python please
The program will prompt the user as to whether you want to convert from Celsius to Fahrenheit or from Fahrenheit to Celsius Write it so each conversion is contained within its own function (i.e., one function to do the math in one direction, a second to do the math in the other direction) These two functions should just have the input temperature as a parameter and return the output temperature in the other units. The actual user input and reporting of results should not be part of these functions
def c_to_f(C): return ((9/5)*C) + 32 def f_to_c(F): return (5/9)*(F-32) choice = input("Was that input Fahrenheit or Celsius c/f? ") temp = float(input("Enter a temperature ")) if choice=="c": print(temp,"Celsius is",c_to_f(temp),"Fahrenheit") else: print(temp, "Fahrenheit equals", f_to_c(temp), "Celsius")
Get Answers For Free
Most questions answered within 1 hours.