Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python Question A1a: Extending Geometric Shapes (1 points) Complete the method length in the class Line that returns the length of the line. Hint: You

Python Question A1a: Extending Geometric Shapes (1 points)

Complete the method length in the class Line that returns the length of the line.

Hint: You can use the Distance Formula to find the length of a line

image text in transcribed

Question A1a: Extending Geometric Shapes (1 points) Complete the method length in the class Line that returns the length of the line Hint: You can use the Distance Formula to find the length of a line class Shape: setorigin(self, x, y): self.x, self.y = x, y def def move(self, dx, dy): ""Move by dx and dy"" " self.x, self.y= self.x + dx, self.y + dy class Line (Shape) def _init (self, x, y, u, v) ""Line with start point (x, y) and end point (u, v)""" Shape.setOrigin(self, x, y) def move (self, dx, dy): Shape.move (self, dx, dy) self.u, self.v self.u + dx, self.v + dy def length(self) pass # Replace this Line with your answer def str (self): return "Line from (str (self.x) + ", " + str(self.y) ") to (" str(self.u)", "str(self.v) + ")" 1 Line(e, e, 3, 4) print (1) assert 1. length() 5.0

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

Students also viewed these Databases questions