I'm new to programming with Python. Currently, I'm working on a program/algorithm to determine maintenance (combined replacement of multiple items) based on these items their condition. To be precise, I want to replace these items when one item's condition is below a predetermined threshold (for example 10%). The problem I have with my code, see below, is when this threshold is met all items are replaced.
def maintenance_action(self):
do_repair = False
for i in item:
if i.condition[-1] <= 10:
do_repair = True
break
if do_repair:
for i in items:
i.repair()
However, I want to include an additional threshold (let's say 50%) which excludes all items with a condition > 50% from the maintenance action. It is important that the first threshold is met (because this item must be replaced) before the second one 'kicks in' (the items I want to include). I hope someone can help me.
Thanks!
Aucun commentaire:
Enregistrer un commentaire