0

So my assignment is asking for rectangle class with default values of 1 and 1 for width and height. It wants a non argument constructor and another constructor to create a rectangle with user specified height and width. So for the default i have

class Rectangle:
    def __init__(self, height = 1, width = 1):
    self.height = height
    self.width = width

but what does it mean by "create a rectangle with user specified height and width"

juanpa.arrivillaga
  • 88,713
  • 10
  • 131
  • 172
  • 1
    It sounds like they want you to use `input` in the constructor to ask the user for width and height, although that would generally be regarded as a bad idea. You'll need to ask your teacher for clarification though. – Carcigenicate Mar 11 '19 at 21:06
  • You need to go to your instructor for clarification, all you will get here is conjecture. To me, it sounds like your assignment is asking for a non-argument `__init__` and then an alternative constructor that takes height and width as parameters. – juanpa.arrivillaga Mar 11 '19 at 22:42

1 Answers1

0

Create a rectangle with user specified height and width means:

to ask the user (via a web page, or via a pop-up?) for the width and height values, and then your script will create a rectangle using those measurements.

For information about building a web page and reading a user's inputs, read about Flask

Here's some information about asking a user for inputs:

User input in dialog box

cssyphus
  • 37,875
  • 18
  • 96
  • 111