muhammad_nasif

TASK_15

Apr 16th, 2021
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.49 KB | None | 0 0
  1. def groceryCalculation(shoppingList, location="dhanmondi"):
  2.     deliveryFee = 30
  3.     if location.lower() != "dhanmondi":
  4.         deliveryFee = 70
  5.     priceDictionary = {"Rice": 105, "Potato": 20, "Chicken": 250, "Beef": 510, "Oil": 85}
  6.     price = 0
  7.     for data in shoppingList:
  8.         price += priceDictionary[data]
  9.  
  10.     price += deliveryFee
  11.  
  12.     return price
  13.  
  14.  
  15. inputList = ["Rice", "Beef", "Rice"]
  16. print(groceryCalculation(inputList))
  17. print(groceryCalculation(inputList,"Mohakhali"))
Advertisement
Add Comment
Please, Sign In to add comment