Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I AM STUCK, I DONT KNOW WHERE AND HOW TO BEGIN. CAN YOU HELP WITH THE CODE FOR PYTHON PLEASE east1.prod. fleet01 wythos Bus-east-1.amazonaws.com/5ddcoaf0a34e/43476797 response

image text in transcribed

I AM STUCK, I DONT KNOW WHERE AND HOW TO BEGIN. CAN YOU HELP WITH THE CODE FOR PYTHON PLEASE

east1.prod. fleet01 wythos Bus-east-1.amazonaws.com/5ddcoaf0a34e/43476797 response content c ontine In this lab, you will define functions which you will call from another function A In the file lab5.py, write a function named distance that takes four float parameters whid represent the two points on the plane (X1. y) and (x ) and returns the distance between the two point The distance D is given by this formula: D = (x2 - 1 + (y2-y. The template of the function is def distance(x1, yi, x2, y2): B. Write the usual main function that will read as input the four values xl, yi, x2, 72, one at a time from the user. They should be considered float values, although integer values may be given. For example, for reading x1 you could use the usual: x1 = eval(input("Input xl: ")) It will then output the two points and the distance between them, as in this example: The distance between point (3, 4) and (5,6) is 2.8284271247461993 C. In the same file above main, write another function even_or_odd that will take as parameter a float number x. If round(x) is an even number, it should output The given number x is closest to an the even number y. else, it should output The given number x is closest to an the odd number y. where x and y should be the actual values of the input and the rounded number, respectively. D. Add to the main() function so that after it outputs the distance between the two points, it calls the function evenor_odd(D), where parameter D is the distance between the two points arch

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

Data Science For Dummies

Authors: Lillian Pierson ,Jake Porway

2nd Edition

1119327636, 978-1119327639

More Books

Students also viewed these Databases questions