Question d’entretien chez Affirm

How would you make this code more generic?