subject

Ask the user for five-coordinate pairs. Store each pair as a tuple, and store all the pairs in a list. Print the slope between adjacent coordinate pairs. So, if you end up with a list of coordinate pairs like this: [(1, 2), (2, 3), (-3, 3), (0, 0), (2, 6)]
… then your program should print the following slopes:

Slope between (1, 2) and (2, 3): 1.0
Slope between (2, 3) and (-3, 3): 0.0
Slope between (-3, 3) and (0, 0): -1.0
Slope between (0, 0) and (2, 6): 3.0
You’ll need to pack the two values you retrieve from the user into a tuple.

As you go through your pairs of tuples, you can also unpack the variables in them into x1, y1, x2, and y2. That way, computing the slope is as simple as:

slope = (y2 - y1) / (x2 - x1)

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 22:00
Consider the following declarations (1, 2, 3, 5, 7)class bagtype{public: void set(string, double, double, double, double); void print() const; string getstyle() const; double getprice() const; void get(double, double, double, double); bagtype(); bagtype(string, double, double, double, double); private: string style: double l; double w; double h; double price; }; a.) write the definition of the number function set so that private members are set according to the parametersb.) write the definition of the member function print that prints the values of the data membersc.) write the definition of the default constructor of the class bagtype so that the private member variables are initialized to "", 0.0, 0.0, 0.0, 0.0, respectively d.) write a c++ statement that prints the value of the object newbag.e.) write a c++ statement that declares the object tempbag of type bagtype, and initialize the member variables of tempbag to "backpack", 15, 8, 20 and 49.99, respectively
Answers: 3
question
Computers and Technology, 23.06.2019 02:00
In the context of an internet connection, llc stands for leased line connection liability limited company local loop complex local loop carrier
Answers: 1
question
Computers and Technology, 23.06.2019 12:10
2. fabulously fit offers memberships for$35 per month plus a $50 enrollmentfee. the fitness studio offersmemberships for $40 per month plus a$35 enrollment fee. in how many monthswill the fitness clubs cost the same? what will the cost be?
Answers: 1
question
Computers and Technology, 23.06.2019 21:30
Which of the following includes the three primary network access technologies? dsl, cable modem, broadband lan, wan, man voip, uc, iptv tcp/ip, ftp, dhcp
Answers: 2
You know the right answer?
Ask the user for five-coordinate pairs. Store each pair as a tuple, and store all the pairs in a lis...
Questions
question
Social Studies, 29.01.2020 06:41