6
answers
2
watching
568
views

Create a new dictionary called prices_stocks using {} format like the example below.

 

prices_stocks={}

Put these values in your prices_stocks dictionary:

  • "banana": [4,5]
  • "apple": [2,2]
  • "orange": [1.5,2.5]
  • "pear": [3,4]

So the key of dictionary is name of item and value is a list (first element of that list is stock and second element is relevant price)

Loop through each key in prices_stocks, for each key, print out the key along with its price and stock information. Finally calculate how much you earn if you sold all of your products. Print the answer in the following format:

 

Part-1:

Item: banana Stock: 4 Price: 5

Item: apple Stock: 2 Price: 2

Item: orange Stock: 1.5 Price: 2.5

Item: pear Stock: 3 Price: 4

If you sold all of your items you earn 39.75

For unlimited access to Homework Help, a Homework+ subscription is required.

Unlock all answers

Get 1 free homework help answer.
Already have an account? Log in
Already have an account? Log in
Already have an account? Log in
Avatar image
Read by 1 person
Already have an account? Log in
Avatar image
Read by 5 people
Already have an account? Log in
Avatar image
Read by 5 people
Already have an account? Log in

Weekly leaderboard

Start filling in the gaps now
Log in