Using a script (code) file, write the following functions:
1. Write the definition of a function that take one number, that represents a temperature in Fahrenheit and prints the equivalent temperature in degrees Celsius.
2. Write the definition of another function that takes one number, that represents speed in miles/hour and prints the equivalent speed in meters/second.
3. Write the definition of a function named main. It takes no input, hence empty parenthesis, and does the following:
O prints Enter 1 to convert Fahrenheit temperature to Celsius
O prints on the next line, Enter 2 to convert speed from miles per hour to meters per second.
O take the input, lets call this main input, and if it is 1, get one input then call the function of step 1 and pass it the input.
O if main input is 2, get one more input and call the function of step 2.
O if main input is neither 1 or 2, print an error message.
After you complete the definition of the function main, write a statement to call main.
Below is an example of how the code should look like:
#Sample Code by Student Name #Created on Some Date #Last Edit on Another Date
def func1(x):
print(x)
def func2(y):
print(y)
print(' ')
print(y)
def main():
func1('hello world')
func2('hello again')
#below we start all the action
main()
Remember to add comments, and that style and best practices will counts towards the points. A program that just "works" is not a guarantee for full credit. Submit your source code file.

Respuesta :

Answer:

def func1(x):

   return (x-32)*(5/9)

def func2(x):

   return (x/2.237)

def main():

   x = ""

   while x != "x":

       choice = input("Enter 1 to convert Fahrenheit temperature to Celsius\n"

                      "Enter 2 to convert speed from miles per hour to meters per second: ")

       if choice == "1":

           temp = input("please enter temperature in farenheit: ")

           print(func1(float(temp))," degrees celcius.")

       elif choice == "2":

           speed = input("please enter speed in miles per hour: ")

           print(func2(float(speed))," meters per second")

       else:

           print("error... enter value again...")

       x = input("enter x to exit, y to continue")

if __name__ == "__main__":

    main()

Explanation:

two function are defines func1 for converting temperature from ferenheit to celcius and func2 to convert speed from miles per hour to meters per second.