为了账号安全,请及时绑定邮箱和手机立即绑定
def square_of_sum(L):
result=0
for num in L:
result=result+num*num
return result
L=[1,3,5,7,9]
result=square_of_sum(L)
print(result)
d = {
'Alice': 45,
'Bob': 60,
'Candy': 75,
'David': 86,
'Ellena': 49
}
old_score=d['Alice']
print("Alice's old score is {}"
.format(old_score))
d['Alice']=60
print(d)
d = {
'Alice': [45],
'Bob': [60],
'Candy': [75],
}
A=[50, 61, 66]
B=[80, 61, 66]
C=[88, 75, 90]
i=0
while i<3:
d['Alice'].append(A[i])
d['Bob'].append(B[i])
d['Candy'].append(C[i])
i+=1
print(d)

最新回答 / qq_慕娘2512265
这段代码中“for b in S”是错误的,因为在循环中修改了集合S的大小,导致了迭代器的大小发生了变化,从而引发了错误。
# Enter a code
a=1
b=1
while a<=10:
a=a+1
b=b*a
print(b)
# Enter a code
age=20
if age>=18:
print('adult')
elif age>6:
print('teenager')
elif age>3:
print('kid')
else:
print('baby')
# Enter a code
age=20
if age<18:
print('adult)
else:
print('teenager')

最赞回答 / 慕勒9248264
age = int(input("请输入你的年龄:"))
if age >= 18:
    print("你已经成年了")
else:
    print("你是未成年人")
<...code...>

最新回答 / 慕设计3379244
s=int(input("请输入年龄"))if 18>s:    print("未成年")else:    print("已成年"
输入print("special string:',\",\,\\\\,\\n,\\t")
print(r'''"To be,or not to be":that is the question.
Whether it's nobler in the mind to suffer.''')
print('\\\\')#==>\\
def sums(n):
if n==1:
return 1
return n+sums(n-1)

def sumss(m):
total = 0
for m in range(1,m+1):
total+=m
return total
L = []
for iterm in range(101):
L.append(iterm*iterm)
print(sum(L))
课程须知
如果您了解程序设计的基本概念,会简单使用命令行,了解中学数学函数的概念,那么对课程学习会有很大的帮助,让您学起来得心应手,快速进入Python世界。
老师告诉你能学到什么?
通过本课程的学习,您将学会搭建基本的Python开发环境,以函数为基础编写完整的Python代码,熟练掌握Python的基本数据类型以及list和dict的操作,灵活使用流程控制语句。

微信扫码,参与3人拼团

微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号

友情提示:

您好,此课程属于迁移课程,您已购买该课程,无需重复购买,感谢您对慕课网的支持!

本次提问将花费2个积分

你的积分不足,无法发表

为什么扣积分?

本次提问将花费2个积分

继续发表请点击 "确定"

为什么扣积分?

举报

0/150
提交
取消