Informatics2-2018/Lab04
A MathWikiből
(Változatok közti eltérés)
17. sor: | 17. sor: | ||
And you also have the prices of the goods where the keys are the items in the store and the values are their unit price | And you also have the prices of the goods where the keys are the items in the store and the values are their unit price | ||
− | + | prices = { | |
− | ' | + | 'apple': 150, |
− | ' | + | 'plum': 190, |
− | ' | + | 'pineapple': 450, |
− | ' | + | 'banana': 300} |
− | + | The function should return the total cost of our shopping: unit price times amount summed for the purchased goods. | |
− | + | ||
− | + | ||
== Cloudcoder == | == Cloudcoder == | ||
− | * | + | * '''grader''' |
+ | * '''topgrades''' | ||
+ | * '''soccergoal''' | ||
+ | * '''enciclopedia''' | ||
+ | * '''storeupdate''' | ||
+ | |||
[[Informatics2-2018/Lab03|previous]] [[Informatics2-2018#Labs|up]] [[Informatics2-2018/Lab05|next]] | [[Informatics2-2018/Lab03|previous]] [[Informatics2-2018#Labs|up]] [[Informatics2-2018/Lab05|next]] |
A lap jelenlegi, 2018. március 8., 12:56-kori változata
Tartalomjegyzék |
Dictionaries
Exercises
Shopping
Let's say that you went to shopping and you have a python dictionary of the purchased goods. The keys are the items you bought and the values are the amount you bought.
purchased = { 'banana': 0.6, 'apple': 1.5, 'pineapple': 2 }
And you also have the prices of the goods where the keys are the items in the store and the values are their unit price
prices = { 'apple': 150, 'plum': 190, 'pineapple': 450, 'banana': 300}
The function should return the total cost of our shopping: unit price times amount summed for the purchased goods.
Cloudcoder
- grader
- topgrades
- soccergoal
- enciclopedia
- storeupdate