Solution: Create Two Dictionaries and Compute the Total Bill
Learn how to create two dictionaries and compute the total bill using the values from these dictionaries.
We'll cover the following...
The solution to the problem of creating two dictionaries and computing the total bill using the values from the dictionaries is given below.
Solution
Press + to interact
# Calculate total bill amountprices = { 'Bottles' : 30, 'Tiffin' : 100, 'Bag' : 400, 'Bicycle' : 2000 }stock = { 'Bottles' : 10 , 'Tiffin' : 8, 'Bag' : 1, 'Bicycle' : 5}total = 0for key in prices :value = prices[key] * stock[key]total += valueprint(key,value)print('Total Bill Amount =' , total)
...