列表[1,2,3,4,5],请使用map()函数输出[1,4,9,16,25],并使用列表推导式提取出大于10的数,最终输出[16,25]
![python这道面试题超简单,你会吗](http://p2.ttnews.xyz/loading.gif)
<code>def f(x):
return x**2
res = map(f, [1, 2, 3, 4, 5])
print([i for i in res if i > 10])/<code>
python中生成随机整数、随机小数、0—1之间小数方法
<code>import random
import numpy as np
a = random.randint(10,20)
res = np.random.randn(5)
ret = random.random()
print("正整数:"+str(a))
print("5个随机小数:"+str(res))
print("0-1随机小数:"+str(ret))/<code>
閱讀更多 程序員亮哥 的文章