forked from fenyx-it-academy/Class4-PythonModule-Week5
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathweek5_3.py
More file actions
24 lines (15 loc) · 853 Bytes
/
week5_3.py
File metadata and controls
24 lines (15 loc) · 853 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
class Product:
def __init__(self,product_id,product_name,product_purchase_price,product_sale_price):
self.product_id=product_id
self.product_name=product_name
self.product_purchase_price=product_purchase_price
self.product_sale_price=product_sale_price
def set_remarks(self):
if self.product_sale_price-self.product_purchase_price<0:
return ' is negative'
else:
return " is positive"
def get_details(self):
return (f'product id:{self.product_id}\nproduct name:{self.product_name}\npurchasa price:{self.product_purchase_price}\nsale price:{self.product_sale_price}\nMargin{self.set_remarks()}')
obj_1=Product('1234','Watch',10.30,8.50)
print(obj_1.get_details())