+ 3
[challenge] Where to buy - Shopping at sololearn
Given a list of shops each with different products. Enter a product . Output the shops who have the product. This is no homework i am not a student (-; shops =[ {'walmart' :[soap,shoe,sweets]}, {'pcking':[keyboard, monitor,sweets]}, {'dodo':[soap,sweets]} ] user enters : soap output: walmart, dodo
7 Antworten
+ 4
Please provide a sample input and output case, for proper understanding.
What all do you need as input? Test cases, then number of shops? Or just the list of products and we determine the number ourselves?
In output, do we need to display the shop number or is there some other format?
+ 4
@kinshuk I added an example.
+ 4
@Kinshuk yes that it is.
Indeed the point is to find a good datastrucure.
you can do it as simple or ellaborated as you want.
+ 4
Here is my Python example with dictionary as data structure
https://code.sololearn.com/cd8Ku62qOZFx
+ 3
So, the data of the shop products is entered before compilation?
+ 2
heres a self generating...shop...things tht can be bought....a random thing....corresponding shops to get it...
### EACH TIME U RUN IT...U GET ALL DIFFERENT OUTCOMES###
https://code.sololearn.com/cR6Qg9O9AFtW/?ref=app