-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprogram46.py
More file actions
29 lines (22 loc) · 775 Bytes
/
program46.py
File metadata and controls
29 lines (22 loc) · 775 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
#Magic methods---------
#__init__(self,name,color):
#__eq__(self, other):
#__str__(self):
class Phone:
def __init__(self,name,color,prise):
self.name = name
self.color = color
self.prise = prise
def __eq__(self, other):
return self.name == other.name and self.color == other.color and self.prise == other.prise
def __str__(self):
return (f"Name : {self.name},Color : {self.color},Prise : {self.prise}")
def display(self):
print(f"Name : {self.name},Color : {self.color},Prise : {self.prise}")
Phone1 = Phone("Apple","White",50000)
Phone2 = Phone("Samsang","Black","40000")
Phone3 = Phone("Xiomi","Red",'30000')
print(Phone1)
print(Phone2)
print(Phone3)
print(Phone1 == Phone2)