Delight1
(Elochukwu Delight)
August 14, 2024, 3:16pm
1
class Point:
def int (self, x, y):
self.x = x
self.y = y
def move(self):
print("move")
def draw(self):
print("draw")
point = Point(10, 20)
print(point.x)
result below:
Traceback (most recent call last):
File “C:\Users\ADMIN\PycharmProjects\Constructors\app.py”, line 13, in
point = Point(10, 20)
^^^^^^^^^^^^^
TypeError: Point() takes no arguments
Process finished with exit code 1
Mholscher
(Menno Hölscher)
August 14, 2024, 3:19pm
2
Simple typo:
__int__
is not equal to __init__
.
Delight1
(Elochukwu Delight)
August 14, 2024, 3:23pm
3
where should i type it. At the beginning or at the end of the code
brass75
(Dan Shernicoff)
August 14, 2024, 3:28pm
4
It should look like this.
Delight1
(Elochukwu Delight)
August 14, 2024, 3:34pm
5
Thank you. It is working now.