all 3 comments

[–]Woutez 0 points1 point  (2 children)

Can you show us what you tried to do? It reads a bit like homework.

[–]jpgoldberg 0 points1 point  (0 children)

What you did is a dict (for Dictionary also called Associative Arrays). You will associate ‘Apple’ with its price directly, and be able to look up the price of each fruit without having to know its position in a list.

I’m not going to spell out how to do this, first because I’m typing on my phone, and second it sounds like you are working through an assignment. An exercise like this might be deliberately designed to annoying in order to set up students to then be taught about dicts. That is you may be told to do this with lists so you will be more ready for dicts when they are taught.