Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #creating three empty list
- price=[]
- amount=[]
- products=[]
- #declaring variables
- optimal_price=0
- minimum=120
- #number of elements as input
- n=int(input())
- #iterating till the range
- for j in range(n):
- sle,ele=input().split()
- sle=int(sle)
- ele=int(ele)
- amount.append(sle)
- price.append(ele)
- #do a loop over price
- for idx,item in enumerate(price):
- if(item>minimum): #making a condition
- price[idx]=minimum
- else:
- minimum=price[idx]
- #multiplication between two lists
- for num1,num2 in zip(price,amount):
- products.append(num1*num2)
- for gle in range(0,len(products)):
- optimal_price=optimal_price+products[gle]
- print(optimal_price)
Add Comment
Please, Sign In to add comment