read the cost of each item purchased by a customer into a cost array. find the total amount
Answers
Answer:
u didnt say the cost how can anyone ans without any knowledge about the question
Explanation:
if u can give whole question the ill try
Answer:
class Purchase:
def __init__(self) :
self. cost=[ ]
self. total_amount=0
def getdata(self) :
for i in range(int(input("Enter the No. of items:))) :
self. cost. append("Enter the cost for product {} :".format(i) )
def display(self) :
print("-"*10)
print("Product No.\t\t\tCost)
for i in range(len(self.cost)) :
print("\t{}\t\t\t\t{ }".format(i+1, self. cost[i])
print("-"*10)
print("\t\t\t\t\t\t\tTotal cost= { }".format(sum(self.cost))
def disp(self) :
self. getdata()
self. display()
obj=Purchase ()
obj. disp()