nth

sknano.core.nth(iterable, n, default=None)[source] [edit on github][source]

Returns the nth item or a default value.

Parameters:

Examples

>>> from sknano.core import nth
>>> nth(range(10), 3)
3
>>> nth(range(10), 20, default='donkey')
'donkey'