最赞回答 / 慕娘9505769
print '2.5 + 10 / 4'输出结果:2.5 + 10 / 4print 2.5 + 10.0 / 4输出结果:5.0注意:10是整数,要加上.0变成浮点10.0,结果才会是5.0,否则就是4.5。
2019-11-21
def square_of_sum(L):
sum=0
for x in L:
sum=sum+s*s
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=sum+s*s
return sum
print square_of_sum([1, 2, 3, 4, 5])
print square_of_sum([-5, 0, 5, 15, 25])
2019-11-21
最新回答 / 东北小慕
list索引从0开始,所以paul的下标是2,如果paul被删掉了,所有paul之后的元素,下标都会改变,比如Bart原来下标是3,当你删除paul后,Bart的下标就是2了
2019-11-20
age = 8
if age >= 18:
print 'adult'
elif age >= 6:
print 'teenager'
else:
print 'kid'
if age >= 18:
print 'adult'
elif age >= 6:
print 'teenager'
else:
print 'kid'
2019-11-20