Skip to content
This repository was archived by the owner on May 7, 2023. It is now read-only.

Latest commit

 

History

History
21 lines (17 loc) · 330 Bytes

reverse.md

File metadata and controls

21 lines (17 loc) · 330 Bytes
title type tags cover dateModified
Reverse list
snippet
list
string
industrial-tokyo
2020-11-02 19:28:27 +0200

Reverses a list or a string.

  • Use slice notation to reverse the list or string.
def reverse(itr):
  return itr[::-1]
reverse([1, 2, 3]) # [3, 2, 1]
reverse('snippet') # 'teppins'