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
最新回答 / 呵阿咯咯
可以创出来一组数组比如 xrange(1,5)直接写就是传出来xrange(1,5)但是他用一个类型包裹起来比如list(xrange(1,5))就能打印出来【1,2,3,4】;list(xrange(1,5))等价range(1,5)从1开始打印到小于5的数字,如果还有第三个参数,就是间隔的长度
2019-03-23
最新回答 / 叶mag
def move(n, a, b, c): if n==1: print a ,' --> ' ,c return move(n-1,a,c,b) move(1,a,b,c) move(n-1,b,a,c)move(4, 'A', 'B', 'C')请理解题意,如果有n个盘,将n-1移到b,另一个移到c,而不是你所写的n-1
2019-03-22
for x in [ '1','2','3','4','5','6','7','8','9']:
for y in [ '1','2','3','4','5','6','7','8','9']:
if ord(x)<ord(y):
print(x+y)
for y in [ '1','2','3','4','5','6','7','8','9']:
if ord(x)<ord(y):
print(x+y)
2019-03-22
最新回答 / qq_慕仙4291659
python3不会A>>> s = set(('Adam','Lisa','Bart','Paul'))>>> >>> print (len(s))SyntaxError: multiple statements found while compiling a single statement
2019-03-21
已采纳回答 / gogod
x = [0,1,2,3,4,5,6,7,8,9]for a in x: for b in x: if a>0 and a<b: print a*10+ b我自己试了一下,海星
2019-03-21
def firstCharUpper(s):
return s[:1].upper()+s[-(len(s)-1):]
print firstCharUpper('hello')
print firstCharUpper('sunday')
print firstCharUpper('september')
return s[:1].upper()+s[-(len(s)-1):]
print firstCharUpper('hello')
print firstCharUpper('sunday')
print firstCharUpper('september')
2019-03-21