I'm going to shop and I'm entering product name in the computer then display the product details this how to code in python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

I'm going to shop and I'm entering product name in the computer then display the product details this how to code in python

21st Dec 2017, 1:47 PM
Aravindhan
Aravindhan - avatar
2 Answers
+ 2
Try to use dictionary: {product 1: description 1, product 2: description 2, etc}. Then you should enter a product name and print dictionary[product_name]. As for me, it's the easiest solution.
21st Dec 2017, 1:57 PM
Petr Leliaev
Petr Leliaev - avatar
+ 1
You can use simple text files to store or a database . if you want to keep it simple , use dictionary or lists , OrderedList is good for it . You can make a search system using difflib (get_close_matches) too . But having a database is best and more practical
21st Dec 2017, 2:01 PM
Riaz
Riaz - avatar