为了账号安全,请及时绑定邮箱和手机立即绑定

初识Python

廖雪峰 移动开发工程师
难度入门
时长 5小时 0分
学习人数
综合评分9.43
3762人评价 查看评价
9.7 内容实用
9.4 简洁易懂
9.2 逻辑清晰
for n in s:
print n[0],':',n[1]
months = set(['Feb',])
s = set(['adam','bart'])
for key in d:
print key,':',d[key]
d[72]='Paul'
print d
print 'Adam:'+str(d.get('Adam'))
print 'Lisa:'+str(d.get('Lisa'))
print 'Bart:'+str(d.get('Bart'))
for x in [1,2,3,4,5,6,7,8,9 ]:
for y in [ 0,1,2,3,4,5,6,7,8,9 ]:
if x<y:
print 10*x+y
name为一个变量名,然后吧name的值给sum,然后执行sum/4.
arr = (['a','b'],['c','d'],'e')
>>> print arr
(['a', 'b'], ['c', 'd'], 'e')
>>> print arr[0][1]
b
def result(x):
if x==1:
return 1;
elif x<1:
return 0;
else:
return option(x)+result(x-1)

def option(x):
if x==1:
return 1;
else:
return option(x-1)+3;

print (result(100))
这讲师之前教数学的吗
for n in L:
sum+=n
r'''Python is created by "Guido". It is free and easy to learn . Let's start lean Python in imooc!'''
结果
'Python is created by "Guido". It is free and easy to learn . Let\'s start lean Python in imooc!'
不加print
巧在了给参数调位置
temp=L[0]
L[0]=L[-1]
L[-1]=temp
L = []
for x in range(1,101):
L.append(x*x)

print sum(L)
课程须知
如果您了解程序设计的基本概念,会简单使用命令行,了解中学数学函数的概念,那么对课程学习会有很大的帮助,让您学起来得心应手,快速进入Python世界。
老师告诉你能学到什么?
通过本课程的学习,您将学会搭建基本的Python开发环境,以函数为基础编写完整的Python代码,熟练掌握Python的基本数据类型以及list和dict的操作。

微信扫码,参与3人拼团

微信客服

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

帮助反馈 APP下载

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

公众号

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

友情提示:

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

本次提问将花费2个积分

你的积分不足,无法发表

为什么扣积分?

本次提问将花费2个积分

继续发表请点击 "确定"

为什么扣积分?

举报

0/150
提交
取消