I'm creating a shopping system in python for learning purposes.
I'm trying to create an array of items with prices. I am using a pick import for a gui user input. here is my code.
from pick import pick
## shopping system
title = 'What would you like to do: '
options = ['shop', 'increase wallet', 'exit']
option, index = pick(options, title)
def wallet_increase(value):
wallet = 15.00
wallet += value
print("New wallet balance $" + str(wallet))
def my_shop():
title = 'What would you like to purchase: '
products = ['eggs', 'cheese', 'meat', 'chocolate']
choice, index = pick(products, title)
print(choice + " has been selected")
if option == 'increase wallet':
value = float(input ("Wallet increase amount? $"))
wallet_increase(value)
if option == 'shop':
my_shop()
essentially what I am trying to achieve is upon the user picking a product (cheese for example). It will ultimately subtract the product price from the wallet value. I currently only have the products with no prices attached to them. I dont understand how I can achieve an array with prices linked to the products.
{product_name: price}