class Shop:#creating a class with name shop
def __init__(self, name, location,dimension):#contructor
#assigning values
self.name = name
self.location = location
self.dimension=dimension
self.item_list=[]#creating empty list
def addItem(self,item):#method to additems
self.item_list.append(item)#storing items
in list
#creating object and calling contructor with parameters
myShop = Shop("Bezza", "Salmiya", (10.5, 6.3, 20.1) );
#calling additems function
myShop.addItem("Rice")
myShop.addItem("Stew")
myShop.addItem("Shrimp")
print("Shop
name:",myShop.name,"\nlocation:",myShop.location,"\ndimensions:",myShop.dimension)#displaying
print("Items:",myShop.item_list)#printig items in list
Get Answers For Free
Most questions answered within 1 hours.