-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClass_Example9.py
More file actions
40 lines (35 loc) · 816 Bytes
/
Class_Example9.py
File metadata and controls
40 lines (35 loc) · 816 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
"""
Describe a class point and represent the point in the from of string
"""
class Point:
"""
Class that describes the point
"""
def __init__(self, intX, intY):
"""
Initializes the variables
:param intX: assigns the value to x
:param intY: assigns the value to y
"""
self.x = intX
self.y = intY
def getX(self):
"""
returns the value x
:return: returns x
"""
return self.x
def getY(self):
"""
returns the value y
:return: returns y
"""
return self.y
def __str__(self):
"""
represents the point in the form of string
:return: returns the string
"""
return f"X-{self.x} and Y-{self.y}"
p1=Point(4,5)
print(p1)