Typescript Remove Last Element In Array Python Example For Loop