将列表的元素提升为权力

Ame*_*155 8 python list python-3.x

如何将列表中的数字提升到一定的幂?

Rob*_*oun 5

另一种map模式,使用lambda代替function.partial()

numbers=[1,2,3,4]
squares=list(map(lambda x:pow(x,2),numbers))
print(squares)
Run Code Online (Sandbox Code Playgroud)