我目前的代码是这样的:
import numpy as np
list1 = []
n = int(input("Enter number of elements for list 1: "))
for i in range(0, n):
ele = float(input("Enter a number: "))
list1.append(ele)
list2 = []
n = int(input("Enter number of elements for list 2: "))
for i in range(0, n):
ele = float(input("Enter a number: "))
list2.append(ele)
add = []
add = list1 + list2
print("\nThe new list is:",add)
print("\n\n95th - 100rd percentiles of new list (in order):","\n",np.percentile(add, 95),"\n",np.percentile(add, 96),"\n",np.percentile(add, 97),"\n",np.percentile(add, 98),"\n",np.percentile(add, 99),"\n",np.percentile(add, 100))
基本上,我想要做的是在底部没有所有 np 语句的情况下得到相同的结果(有没有办法打印添加列表中从第 95 个到第 100 个百分位的所有数字)?
非常感谢!