Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using a script ( code ) file, write the following functions: Write the definition of a function that takes one number, that represents a temperature

Using a script (code) file, write the following functions: Write the definition of a function that takes one number, that represents a temperature in Fahrenheit. The function prints the equivalent temperature in degrees Celsius. (1 point) Write the definition of another function that takes two numbers, that represent speed in miles/hour and time in minutes. The function prints the distance traveled based on that speed and time. (1 points) Write the definition of a function named main. It takes no input, hence empty parenthesis, and does the following: - starts by showing on 3 lines using one print statement (you'll need to use the escape character for the new line) the following: Enter 1 to convert Fahrenheit temperature to Celsius Enter to calculate distance travelled Enter 3 to exit - uses one input statement to get which number the user wants to input (1 or 2). Call this main_input. Make sure to make main_input an integer. - if main_input contains 1, get one input then call the function of step 1 and pass it the input. After this line, call main. - if main_input contains 2, get two more inputs and call the function of step 2 and pass it those two inputs; watch out for the order.After this line call main. - if main_input contains 3, then print a good bye message. Do not call main, as this will cause 'us' not to exit. - if main-input is none of the above, print an error message, then call main. After you complete the definition of the function main, write a statement to call main. (3 points) 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): #do some math here to figure out how to convert x. Save the result in y. Use meaningful name for your variables. print(y) def func2(x,y): #do some math here to figure out how to calculate the distance based on x and y. Save the result in z. Use meaningful name for your variables. print(z) def main(): # print the first three lines as listed in the specs above MI = int(input("...")) # check if MI ==1, then get another input, call it A, then call func1(A), then call main # otherwise check if MI ==2, then get two more inputs, call them A and B, then call func2(A,B), then call main # otherwise check if MI contains the number 3, then print the good bye message. # otherwise (no more checking) print an error message, then call main #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. Back to Module 4. Choose a submission type Drag a file here, or click to select a file to upload Drag a file here, or Choose a file to upload File permitted: PY No file chosen or

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Database Management Systems

Authors: Patricia Ward, George A Dafoulas

1st Edition

1844804526, 978-1844804528

More Books

Students also viewed these Databases questions