I will try to keep this as brief as possible as I tried to find an answer and I couldn't. I am trying to create a simple till system. I am using a CSV file to store the description, price and stock of the product. If the user logs in as a manager they will be able to change the stock of a particular product. I find it very difficult to understand how to change the new stock. i forgot to mention that I use lists to store each category Let's say I have the following file
apples,1,11
grape,1.2,1
chocolate,0.75,15
bananas,1.35,27
And the following code to create the lists:
Products = []
Prices = []
Prices= []
import csv
with open('listlist.csv') as csvfile:
readCSV = csv.reader(csvfile,delimiter=',')
for row in readCSV:
print(row)
item = row[0]
price = row[1]
stock = row[2]
Products.append(item)
Prices.append(price)
Stock.append(int(stock))
If the manager wants to change the stock of the item 'grape' from 1 to 11, how should I approach this in the easiest way?