Write a Rectangle class in Python language, allowing you to
build a
rectangle with length and width attributes.
Answers
Answered by
1
your main file you have:
rectangle = (length, width)
which does not make a new rectangle object. What you want is
rectangle = rectangle.rectangle(length, width)
which is a bit wordy, and will also fail as you have a local variable and the imported module as the same name. You can fix that by using CamelCase for your class names, and just importing the class:
from rectangle import Rectangle # change the name in rectangle.py as well
...
rectangle = Rectangle(length,...
Similar questions