Informatics2-2020/Lab04

A MathWikiből
(Változatok közti eltérés)
a
a
5. sor: 5. sor:
 
== Shopping ==
 
== Shopping ==
  
Let's say that you went to shopping and you have a python dictionary of the purchased goods.
+
In the <tt>hazi</tt> system, exercise: '''<tt>shopping </tt>'''
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.
+
  
 
== Enciclopedia ==
 
== Enciclopedia ==

A lap 2020. március 4., 12:21-kori változata

previous up next

Exercises

Shopping

In the hazi system, exercise: shopping

Enciclopedia

In the hazi system, exercise: enciclopedia

previous up next

Személyes eszközök