为了账号安全,请及时绑定邮箱和手机立即绑定
写程序看来数学的基础概念必须明了切扎实。

最新回答 / 翎栋
# -*- coding: utf-8 -*-
# 加上上面这个注释就可以带有中文的注释了b = "Python"print("Life is short, you need {c}".format(c=b))print("Life is short, you need {0}".format("Python"))# no chinese world or 

最赞回答 / 立城大渣渣
因为也没教你接收update()的返回值啊。不赋值直接调用就行了,你这里的set_old已经是存储了更新后的结果
# Enter a code
def greet(what = 'world'):
print('Hello,{}'.format(what))
# Enter a code
def func(x):
if isinstance(x, list):
return sum(x)
elif isinstance(x, tuple):
multi = 1
for n in x:
multi *= n
return multi
# coding=utf-8
def sum_func(n):
if n <= 1:
return 1
else:
return (n + sum_func(n-1))


def sum_for():
total = 0
for n in range(1, 101):
total += n
return total
# Enter a code
L = []
for n in range(1, 101):
L.append(n*n)
print(L)
print(sum(L))
# Enter a code
s1 = set([1, 2, 3, 4, 5])
s2 = set([1, 2, 3, 4, 5, 6, 7, 8, 9])
if not s1.isdisjoint(s2):
print(s1.intersection(s2))
# Enter a code
L = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
S = set([1, 3, 5, 7, 9, 11])
for n in L:
if n not in S:
S.add(n)
else:
S.remove(n)
print(S)
# Enter a code
L = ['Alice', 'Bob', 'Candy', 'David', 'Ellena']
L.append('Zero')
L.append('Phoebe')
L.append('Gen')
L.sort()
print(L)
Score = [['Chinses',92],['Math',75],['English',99]]
T = ('Alice', 'Bob', 'Candy', 'David', 'Ellena')
# 通过下标的方式访问元素
print(T[0]) # ==> Alice
print(T[4]) # ==> Ellena
# 切片
print(T[1:3]) # ==> ('Bob', 'Candy')
candy错了吧,应该是David吧
num = 3.14 * 1.57

print (round (num , 2))

round 需要嵌套在print里面

最赞回答 / 翎栋
L = [75, 92, 59, 68, 99]def avg(l):    return sum(l) / len(l)def avg2(l):    sum1 = 0    for i in  l:        sum1 += i    return sum1 / len(l)average = avg2(L)print(average)

最新回答 / 快乐鸡哥
sum=0是给总成绩一开始赋0,根据循环,依次把L列表中的分数加到sum中。可以理解为0+75、0+75+92、...

最新回答 / 还能学
for循环L1分别会是 [1,2,3]|[5,3,2]|[7,3,2]            L1[0]           0 1 2  0 1 2   0 1 2           每次取L1的0号元素
课程须知
如果您了解程序设计的基本概念,会简单使用命令行,了解中学数学函数的概念,那么对课程学习会有很大的帮助,让您学起来得心应手,快速进入Python世界。
老师告诉你能学到什么?
通过本课程的学习,您将学会搭建基本的Python开发环境,以函数为基础编写完整的Python代码,熟练掌握Python的基本数据类型以及list和dict的操作,灵活使用流程控制语句。

微信扫码,参与3人拼团

微信客服

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

帮助反馈 APP下载

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

公众号

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

友情提示:

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

本次提问将花费2个积分

你的积分不足,无法发表

为什么扣积分?

本次提问将花费2个积分

继续发表请点击 "确定"

为什么扣积分?

举报

0/150
提交
取消