Write a Python function called nth that takes two parameters: an integer n and a sequence or iterable seq …
Write a Python function called nth that takes two parameters: an integer n and a sequence or iterable seq …: a task in repo2rlenv-r2e (Harbor dataset). The function must handle two categories of input: 1. Indexable sequences (e.g., list, tuple, str, range): Use direct index access. Support both…
The task
The function must handle two categories of input: 1. **Indexable sequences** (e.g., list, tuple, str, range): Use direct index access. Support both positive and negative indices following standard Python indexing rules (e.g., index -1 returns the last element). Return `None` if the index is out of bounds. 2.…
Part of FineEnvs/repo2rlenv-r2e.