Merge pull request #288 from AkshatBhat/master

Add reverse_list
This commit is contained in:
Isabelle Viktoria Maciohsek
2020-10-06 18:58:19 +03:00
committed by GitHub

17
snippets/reverse_list.md Normal file
View File

@ -0,0 +1,17 @@
---
title: reverse_list
tags: list,beginner
---
Returns the reverse of a list.
- Use list slicing to reverse the list.
```py
def reverse_list(arr):
return arr[::-1]
```
```py
reverse_list([1,6,7,0,5]) #[5, 0, 7, 6, 1]
```