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
Step: 1
usrbinpython3 def func1f celcius fahrenheit 325 cf3295 ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started