<jupyter_start><jupyter_text>Records Before Bill Genration<jupyter_code># Records Before 
print("Product Id   ","Price     ","      Quantity       ","    Product" )
for i in records:
    print(i,"          " , records[i]['Price( in RS.)'],"           ", records[i]['Quantity_Available'],"                ",records[i]['Product_Name'],)<jupyter_output>Product Id    Price            Quantity            Product
1001            600             410                  Pen Drive
1002            499             207                  T-Shirt
1003            30             300                  Potato Chips
1004            200             147                  Face Wash
1005            150             196                  Washing Powder
1006            48             218                  Sprite
1007            40             201                  Coke
1008            48             101                  Water
1009            40             123                  Pepsi
1010            999             149                  Bat
1011            50             145                  Tennis Ball
1012            100             200                  Tomato Ketchup
1013            120             152                  Red Chilli Sauce
1014            120             142                  Green Chilli Sauce
1015            100             131                  Pizza[...]<jupyter_text>Taking User Inputs for Genration of Bill<jupyter_code>Customer_Name = input("Please Enter Your name: ")
product_lst = []
quant_lst = []



while True:
        product = str(input("Enter the product_Id: "))
        quantity = int(input("Enter the quantity: "))
        records[product]['Quantity_Available'] = records[product]['Quantity_Available'] - quantity
        
        js = json.dumps(records)
        fd = open("records.json",'w')
        fd.write(js)
        fd.close()
        
        product_lst.append(product)
        quant_lst.append(quantity)
        
        before_discount_price = records[product]['Price( in RS.)'] * quantity
        after_discount_price = 0.93 * before_discount_price
        
        
        if (os.path.getsize("sales.json") == 0):
            j = 0
        else:
            with open('sales.json', ) as f:
                data = json.load(f)
                k = data.keys()
                k = list(k)
                j = k[-1]
                j = int(j)
        
        j += 1
        
        
        a_dictionary = {j:{"Time":time.ctime(),"Product_Id":product,"Quantity":quantity,"Amount":round(after_discount_price)}}
        with open("sales.json", "r+") as file:
            data = json.load(file)
            data.update(a_dictionary)
            file.seek(0)
            json.dump(data, file)
        
        if (input("DO you want to buy another product Y/N").lower() =='n'):
            break

product_lst
quant_lst<jupyter_output><empty_output><jupyter_text>Genrate Bill<jupyter_code>print("________________________________________________________________________________")
print(time.ctime())
print(Customer_Name)
print("________________________________________________________________________________")
print("--------------------------------------------------------------------------------")
Total_Amount = 0
for i in range(len(product_lst)):
    print("Product: ", records[product_lst[i]]['Product_Name'])
    print("Price: ", records[product_lst[i]]['Price( in RS.)'])
    print("Quantity: ", quant_lst[i])
    print("Billing Amount: ", records[product_lst[i]]['Price( in RS.)'] * quant_lst[i])

    before_discount_price = records[product_lst[i]]['Price( in RS.)'] * quant_lst[i]
    after_discount_price = 0.93 * before_discount_price
    Total_Amount += round(after_discount_price)

    print("Discounted Amount: ", round(after_discount_price) )
    
    print("\n")

print("________________________________________________________________________________")

#Discount on purchase of specific ammount
#before_discount_price = records[product]['Price( in RS.)'] * quantity
#after_discount_price = 0.93 * before_discount_price   # 7% discount on every purchase

print("Total Payable Amount: ",round(Total_Amount))
print("________________________________________________________________________________")
print("--------------------------------------------------------------------------------")

   
print("Congratulations, You have saved Rs.",round(1.07*Total_Amount-1.00*Total_Amount))
print("***********************************************************************************")
print("Thank you :)")
print("Have a nice Day ahead :)")<jupyter_output>________________________________________________________________________________
Mon Sep  6 18:16:40 2021
Saurabh
________________________________________________________________________________
--------------------------------------------------------------------------------
Product:  Pen Drive
Price:  600
Quantity:  2
Billing Amount:  1200
Discounted Amount:  1116


Product:  Face Wash
Price:  200
Quantity:  3
Billing Amount:  600
Discounted Amount:  558


Product:  Sprite
Price:  48
Quantity:  1
Billing Amount:  48
Discounted Amount:  45


Product:  Mobile
Price:  16999
Quantity:  1
Billing Amount:  16999
Discounted Amount:  15809


________________________________________________________________________________
Total Payable Amount:  17528
________________________________________________________________________________
--------------------------------------------------------------------------------
Congratulations, You have saved Rs. 1227
********************************************[...]<jupyter_text>updated Records<jupyter_code>#updated quantity


print("Product Id   ","Price     ","      Quantity       ","    Product" )
for i in records:
    print(i,"          " , records[i]['Price( in RS.)'],"           ", records[i]['Quantity_Available'],"                ",records[i]['Product_Name'],)
fd = open("sales.json",'r')
read = fd.read()
fd.close()

sales_json = json.loads(read)
sales_json<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.16785654989208035, 'fraction_numerical': 0.03835298024240412, 'mean_word_length': 2.002991026919242, 'pattern_counts': {'":': 4, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 30, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '202285', 'license': 'Apache-2.0', 'n_tokens_mistral': 1674, 'n_tokens_neox': 1454, 'n_words': 355, 'path': 'Inventory Management System/IMS product_purchase.ipynb', 'repo_name': 'saurabh-wani/Skill-India-AI-ML-Scholarship', 'size': '6023'}