Question d’entretien chez JPMorganChase

Write a python program for the task below