mardi 16 juin 2020

Search for all values 'greater than' and operate (subtraction)

I'm new to Python and starting to build a small and short simulation scenario for pallet movements.

So basically I have an array "storage client" which accumulates pallets until it reaches a number (120) and then ships it back to the warehouse.

At one point it's kind of like this:

Shipper_Leaving = 0
Storages = [80, 140, 2, 43, 121]

if any (y>120 for y in Storages):
    Shipper_Leaving[y] = Shipper_Leaving + 120
##Storages - [0,120,0,0,120]
##print storages 
[80, 120, 2, 43, 1]

And then I'm stuck (at the #'s)... I'm trying to find how to do this.

Thanks!

Aucun commentaire:

Enregistrer un commentaire