已知有列表1s-154,36.75.28,501,请完成一下操作。 1、在列表尾部插入元素42 2、删除并输出28 3、将列表按降序排序
时间: 2024-05-06 22:20:44 浏览: 117
1. 在列表尾部插入元素42:
```python
lst = ['1s-154', 36.75, 28, 501]
lst.append(42)
print(lst)
```
输出:
```
['1s-154', 36.75, 28, 501, 42]
```
2. 删除并输出28:
```python
lst = ['1s-154', 36.75, 28, 501]
item = lst.pop(2)
print("删除的元素是:", item)
print("列表变为:", lst)
```
输出:
```
删除的元素是: 28
列表变为: ['1s-154', 36.75, 501]
```
3. 将列表按降序排序:
```python
lst = ['1s-154', 36.75, 28, 501]
lst.sort(reverse=True)
print(lst)
```
输出:
```
[501, 36.75, '1s-154', 28]
```
相关问题
[84.15, 74.25, 97.2, 83.25, 102.6, 88.8, 77.55, 91.8, 68.45, 102.6, 86.4, 64.35, 81.6, 97.2, 81.0, 76.5, 83.25, 29.7, 93.6, 79.8, 80.0, 91.2, 72.0, 88.8, 73.6, 94.05, 34.65, 52.8, 64.35, 69.75, 79.2, 81.6, 84.6, 81.0, 79.2, 91.8, 77.4, 83.25, 64.8, 74.25, 36.75, 37.7, 85.8, 92.5, 88.8, 39.6, 54.45, 86.4, 91.8, 73.8, 76.8, 77.55, 57.6, 90.75, 88.2, 86.4, 58.5, 76.5, 81.0, 49.5, 82.5, 88.2, 91.2, 66.0, 74.25, 99.9, 60.45, 79.2, 86.4, 75.2, 72.6, 96.9, 56.1, 74.25, 64.8, 81.6, 89.25, 88.8, 97.2, 96.35, 81.6, 72.0, 80.85, 94.35, 74.25, 80.0, 94.35, 36.3, 67.2, 81.6, 73.5, 76.8, 66.0, 86.4, 98.05, 81.4, 86.4, 70.2, 74.4, 44.55, 39.6, 87.45, 83.25, 82.5, 74.25, 82.8, 75.2, 86.4, 89.1, 37.95, 61.5, 72.6, 98.4, 86.95, 89.1, 89.1, 79.2, 81.0, 80.85, 52.5, 56.1, 69.3, 84.6, 83.25, 79.2, 66.5, 93.6, 81.6, 86.4, 97.2, 89.1, 91.8, 70.4, 79.2, 81.0, 100.8, 84.15, 90.0, 74.25, 64.8, 94.35, 81.0, 81.0, 93.6, 91.8, 77.55, 61.5, 89.1, 94.35, 81.7, 90.65, 92.75, 64.35, 66.0, 37.95, 91.8, 86.4, 75.0, 76.8, 75.2, 61.05, 91.8, 72.0, 94.05, 81.0, 81.6, 91.8, 95.2, 94.05, 81.0, 68.8, 84.6, 86.4, 89.25, 75.6, 84.15, 76.8, 85.75, 88.2, 85.8, 81.0, 72.5, 76.8, 55.8, 82.5, 72.0, 91.8, 70.95, 81.0, 86.4, 97.2, 72.0, 92.5, 69.3, 91.8, 84.15, 55.8, 89.1, 86.4, 86.4, 76.8, 88.2, 94.5, 92.5, 81.6, 72.0, 88.8, 89.1, 59.2, 87.4, 72.0, 85.8, 72.0, 72.0, 94.35, 98.4, 75.6, 89.1, 66.6, 76.5, 75.9, 70.2, 86.4, 91.8, 85.8, 54.45, 41.85, 88.0, 78.4, 85.8, 79.2, 66.6, 79.2, 59.4, 67.2, 86.4, 79.2, 86.4, 39.6, 84.15, 86.1, 81.6, 89.1, 79.2, 91.2, 76.5, 97.2, 99.9, 79.2, 76.8, 71.75, 39.6, 48.6, 79.2, 89.1, 81.0, 84.6, 81.6, 68.8, 81.6, 86.4, 72.0, 89.1, 89.6, 47.25, 63.0, 97.2, 91.8, 46.8, 90.0, 62.4, 88.8, 64.35, 89.1, 77.7, 86.4, 88.8, 91.8, 81.6, 85.8, 73.6, 86.95, 92.4, 91.8, 94.35, 74.25, 69.3, 83.2, 73.5, 82.8, 74.25, 95.4, 72.0, 77.9, 75.2, 76.8, 97.2, 84.15, 66.0, 78.4]按照这组数据的概率分布采样10个数
我可以回答这个问题。根据这组数据的概率分布,可以使用随机数生成器来进行采样。以下是采样的10个数:89.1, 81.6, 86.4, 81.6, 81., 81.6, 81., 81.6, 86.4, 81.。
阅读全文