1. Question: x=[...], 求x所有元素的平方和 Answer: (普通版)1 def fun(x):2 total = 03 for e in x:4 total = total + e**25 return total Answer:(Pythonic)1 def fun(x):2 return sum([e**2 for e in x]) Read More
posted @ 2013-01-05 21:55
Excelight
Views(128)
Comments(0)
Diggs(0)

浙公网安备 33010602011771号