def square_of_sum(L):
sum = 0
for x in L:
sum+=x*x
return sum
print square_of_sum([1, 2, 3, 4, 5])
print square_of_sum([-5, 0, 5, 15, 25])
sum = 0
for x in L:
sum+=x*x
return sum
print square_of_sum([1, 2, 3, 4, 5])
print square_of_sum([-5, 0, 5, 15, 25])
2019-03-25
age = 20
if 18>age >= 6:
print 'teenager'
elif age >= 18:
print 'adult'
else:
print 'kid'
if 18>age >= 6:
print 'teenager'
elif age >= 18:
print 'adult'
else:
print 'kid'
2019-03-24
已采纳回答 / Close_0
因为 ‘Adam’是字符串,而d['Adam']返回int类型的95.Python 不支持这两种类型用‘+’号连接,输出的话用‘,’即可
TypeError: unsupported operand type(s) for +: 'int' and 'str'
2019-03-24
已采纳回答 / 慕桂英9269908
因为是递归的,所以在move(n)递归给move(n-1)的时候,move(n-1)会继续递归给move(n-2),如此递归下去,最后是move(1),move(1)的值会返回到move(2)中,move(2)的值会返回到move(3)中,再继续如此依序返回,最后整个的结果最开始其实是从move开始的
2019-03-24
最新回答 / 人间世支离疏
def square_sum(L): s=0 for x in L: if x/2==0:#没有意义的判断,只能排除x==0或1的结果,即便是求奇数的平方和,应该是 if x%2 == 0 continue s=s+x**2 return s#求list列表里每个素数的平方的和#-*- coding: UTF-8 -*-def square_sum(list): sum = 0 is_zhishu=0 for x in ...
2019-03-23
def quare_of_sum(L):
s = 0
for i in L:
j = i*i
s+=j
return s
print square_of_sum([1,2,3,4,5])
print square_of_sum([-5,0,5,15,25])
s = 0
for i in L:
j = i*i
s+=j
return s
print square_of_sum([1,2,3,4,5])
print square_of_sum([-5,0,5,15,25])
2019-03-23