+ 2
Problem with Classes
class Rectangle: def __int__(self,width,height): self.width=width self.height=height width= input() height= input() Rect= Rectangle(width,height) volume=int(w)*int(h) print(volume) Why is telling me that Rectangle() takes no arguements
4 Answers
+ 6
Sean , also variables "w" and "h" are not defined. If you create a class, it's better to create method in the class for volume calculation. Look at the code. Hope it helps you.
https://code.sololearn.com/c3c98MatPAX6/?ref=app
+ 4
you have .. def __int__(self,width,height):
you need .. def __init__(self, width, height):....your missing the last 'i' in __init__.
+ 3
Better to add the Python tag to your question.
+ 1
class Rectangle:
def __init__(self, width, height):
self.w = width
self.h = height
def vol(self):
return self.w * self.h
w = int(input())
h = int(input())
Quadrilateral = Rectangle(w, h)
print (Quadrilateral.vol())
Try this approach!