x = Bookshop()
x.orders = [ [1, ("5464", 4, 9.99), ("8274",18,12.99), ("9744", 9, 44.95)],
[2, ("5464", 9, 9.99), ("9744", 9, 44.95)],
[3, ("5464", 9, 9.99), ("88112", 11, 24.99)],
[4, ("8732", 7, 11.99), ("7733", 11,18.99), ("88112", 5, 39.95)] ]r1 = x.prodcut_price()
print(r1)class Bookshop:def __init__(self):self.orders = 0def prodcut_price(self):result1 = list(map(lambda x:(x[1][0],x[1][1]*x[1][2]) if x[1][1]*x[1][2]>=100 else (x[1][0],x[1][1]*x[1][2]+10),self.orders))#print(result1)return result1
The list is basically the store number and each store sell some books with the code, quantity and the price.I am trying to create a method that will take each book quantity * price and print them in a tuple within list using lambda,filter and map only. what I got is that
[('5464', 39.96), ('5464', 89.91), ('5464', 89.91), ('8732', 83.93)]
but I need it for the whole list