mardi 2 février 2021

Can someone please explain this chunk of code written in Python? I don't get it

Hello Fellow Python Programmers,

I have a chunk of code that works in my situation but I want to understand. Can someone please elaborate line by line if possible?

Thanks in advance.

inventory = test['Inventory'][0]
test['new'] = inventory
item = test['BoxType'][0]

for i in range(1,len(test)):
    test['new'][i] = inventory - test['Average'][i] + test['Upcoming QTY'][i]
    inventory = test['new'][i]
    
    if test['BoxType'][i] != item:
        inventory = test['Inventory'][i]
        test['new'][i] = test['Inventory'][i]
        item = test['BoxType'][i]

Aucun commentaire:

Enregistrer un commentaire