Skip to content
This repository has been archived by the owner on Dec 15, 2020. It is now read-only.

Commit

Permalink
added second fn
Browse files Browse the repository at this point in the history
  • Loading branch information
Jackevansevo committed Apr 27, 2017
1 parent 038fb2b commit c643064
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions basic_utils/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ def first(seq: Sequence) -> Any:
return next(iter(seq))


def second(seq: Sequence) -> Any:
"""
Returns second element in a sequence.
>>> second([1, 2, 3])
2
"""
return seq[1]


def last(seq: Sequence) -> Any:
"""
Returns the last item in a Sequence
Expand Down

0 comments on commit c643064

Please sign in to comment.