# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# ## Read the record.json file and access them

# +
import json
fd=open("record.json",'r')
r=fd.read()
fd.close()

record=json.loads(r)
# -

# ### List of items available in the record

record

# ### Code to insert inventory to the record.json

# +
prod_id = str(input("Enter product id: "))
name = str(input("Enter name: "))
pr = int(input("Enter price: "))
qn = int(input("Enter quantity: "))
cat=str(input("enter the category of the item: "))
disc= int(input("enter the discount available on the item : "))

record[prod_id] = {'name': name, 'pr': pr, 'qn': qn, 'category' : cat, 'Discount' : disc}

js = json.dumps(record)

fd = open("record.json",'w')
fd.write(js)
fd.close()
# -



StarcoderdataJupyterScriptsDedupFiltered