Prepare repository for merge

This commit is contained in:
Angelos Chalaris
2023-05-01 22:43:50 +03:00
parent ab1ea476c5
commit a5ca5190e5
169 changed files with 0 additions and 626 deletions

22
python/snippets/sample.md Normal file
View File

@ -0,0 +1,22 @@
---
title: Random element in list
type: snippet
tags: [list,random]
cover: walking-on-top
dateModified: 2020-10-28T11:45:34+02:00
---
Returns a random element from a list.
- Use `random.choice()` to get a random element from `lst`.
```py
from random import choice
def sample(lst):
return choice(lst)
```
```py
sample([3, 7, 9, 11]) # 9
```