vault backup: 2023-04-27 14:02:42
This commit is contained in:
5
04. Programming/Python/choices().md
Normal file
5
04. Programming/Python/choices().md
Normal file
@@ -0,0 +1,5 @@
|
||||
從list中選出n個項目,有可能重複:
|
||||
```python
|
||||
import random
|
||||
random.choices(seq, n)
|
||||
```
|
||||
7
04. Programming/Python/sample().md
Normal file
7
04. Programming/Python/sample().md
Normal file
@@ -0,0 +1,7 @@
|
||||
從一個list中,選出n個不重複的項目:
|
||||
```python
|
||||
import random
|
||||
random.sample(seq, n)
|
||||
```
|
||||
|
||||
不像 [[choices()]] 是會重複的。
|
||||
Reference in New Issue
Block a user