decimate python
时间: 2023-08-15 19:13:54 浏览: 73
DECIMATE
In Python, the term "decimate" typically refers to reducing the size of a list or array by a factor of 10. To achieve this, you can use slicing to select every 10th element from the list. Here's an example:
```python
my_list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
decimated_list = my_list[::10]
print(decimated_list)
```
Output:
```
[1, 11]
```
In this example, the `my_list` is decimated by selecting every 10th element using the slicing notation `::10`. The resulting `decimated_list` contains only the first and eleventh elements from the original list.
阅读全文