def sub_sum(l):
x = []
y = []
for i in range(len(l)):
if i % 2 ==0:
x.append(l[i]*l[i])
else:
y.append(l[i]*l[i])
print("奇数位平方和为{0},\n偶数位平方和为{1}".format(sum(x),sum(y)))
sub_sum([1,2,3,4])
x = []
y = []
for i in range(len(l)):
if i % 2 ==0:
x.append(l[i]*l[i])
else:
y.append(l[i]*l[i])
print("奇数位平方和为{0},\n偶数位平方和为{1}".format(sum(x),sum(y)))
sub_sum([1,2,3,4])
2022-11-22
def square_of_sum(l):
for i in l:
eg = []
eg.append(i * i)
sum(eg)
print(sum(eg))
square_of_sum([1, 3, 5, 7])
for i in l:
eg = []
eg.append(i * i)
sum(eg)
print(sum(eg))
square_of_sum([1, 3, 5, 7])
2022-11-22
最新回答 / 暗夜子爵
<...code...>d = { 'Alice': 45, 'Bob': 60, 'Candy': 75, 'David': 86, 'Ellena': 49, 'Gaven': 86}AA = ('Alice', 'Bob', 'Candy', 'Mimi', 'David')for i in AA: print(i + ":" + str(d.get(i)))
2022-11-21
names=['Alice','Bob','David','Ellena']
news=['Zero','Phoebe','Gen']
news.sort()
print(news)
count=len(names)
for n in news:
names.insert(count,n)
count+=1
print(names)
news=['Zero','Phoebe','Gen']
news.sort()
print(news)
count=len(names)
for n in news:
names.insert(count,n)
count+=1
print(names)
2022-11-19
print(r"""'To be, or not to be:
that is the question.
Whether it's nobler in the mind to suffer.'""")
that is the question.
Whether it's nobler in the mind to suffer.'""")
2022-11-01
print(r"""'\"To be, or not to be\": that is the question.\n Whether it\'s nobler in the mind to suffer.'""")
2022-11-01
已采纳回答 / qq_终结的开始_0
函数里面取值用中括号[ ] 不是用小括号( )names = kwargs['names'] gender = kwargs['gender'] age = kwargs['age']
2022-10-29