题目来自:http://www.sohu.com/a/231439410_308467

合并k个数列(比如k=2)数列并进行排序:

list1=[1,3,5,7]
list2=[8,6,4,2]

list1.extend(list2)
print list1
x=list1[0]
for j in range(len(list1)-1):
    for i in range(len(list1)-1):
        if list1[i] > list1[i+1]:
            x=list1[i]
            list1[i]=list1[i+1]
            list1[i+1]=x

print list1


如何寻找百分位数?

微软AI面试题解答,2道入门级别

就拿上面这道题目为例吧:过去12小时内共有1000人来过这个购物中心,请估测,截止至何时,购物中心刚好达到30%的总客流量?

import numpy as np
list1=[0,2,4,6,8,10,12]
list2=[0,350,1100,2400,6500,8850,10000]

sign=list2[-1]*0.30
for x in list2:
    if x > sign:

        break

print x
index=list2.index(x)
print list1[index]
list1.extend(list2)

相关文章:

  • 2022-12-23
  • 2021-07-10
  • 2022-12-23
  • 2021-05-12
  • 2021-11-16
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-10-02
  • 2022-12-23
  • 2021-12-19
  • 2021-10-28
  • 2021-09-10
  • 2021-06-11
相关资源
相似解决方案