Typescript Change Index In Python 3 The Condition