Question: Using a script (code) file, write the following functions: -Write the definition of a function that take one number, that represents a temperature in Fahrenheit

Using a script (code) file, write the following functions:

-Write the definition of a function that take one number, that represents a temperature in Fahrenheit and prints the equivalent temperature in degrees Celsius.

-Write the definition of another function that takes one number, that represents speed in miles/hour and prints the equivalent speed in meters/second.

-Write the definition of a function named main. It takes no input, hence empty parenthesis, and does the following:
- prints Enter 1 to convert Fahrenheit temperature to Celsius
- prints on the next line, Enter 2 to convert speed from miles per hour to meters per second.
-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.
- if main input is 2, get one more input and call the function of step 2.
- 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.

Example of what the code should look like:

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()

Step by Step Solution

3.36 Rating (146 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To solve the problem we will create a Python script with three main functions as described 1 Convert Fahrenheit to Celsius A function that takes a Fah... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!