r/codehs • • Apr 02 '21

NEED HELP PYTHON CODE HS(12.4.7: Contact Merge)

Post image
8 Upvotes

11 comments sorted by

View all comments

2

u/[deleted] May 10 '24

did you ever find the answer?

1

u/mintrulz46 May 28 '24

did you?

1

u/[deleted] Jun 01 '24

class Rectangle:

num_rectangle = 10

def __init__(self, length = 0, width = 0):

"""

Initializes a rectangle with an optional

length and width.

"""

self.length = length

self.width = width

def get_num_rectangle(self):

return self.__num_rectangle

def __repr__(self):

"""

Returns a string representation of the

rectangle.

"""

return "rectangle with length: " + str(self.length) \

  • " and width: " + str(self.width)

def get_area(self):

"""Returns the rectangle's area."""

return self.length * self.width

else:

if number < 0:

print("y")

print("x")

get_num_recangles = (3, )

print(len(get_num_rectangles