Typescript Get Last Index Of Array In Python Code