Add reverse_list

This commit is contained in:
AkshatBhat
2020-10-06 01:15:12 +05:30
parent a2ff06d3a6
commit 8bf824dc9b

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]
```