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

初识Python

廖雪峰 移动开发工程师
难度入门
时长 5小时 0分
学习人数
综合评分9.43
3762人评价 查看评价
9.7 内容实用
9.4 简洁易懂
9.2 逻辑清晰
L = []
x = 0
while x<100:
x = x+1
a = x*x
L.append(a)
print sum(L)
sum=0
for a in L:
sum=sum+a*a
return sum
L = []
a = 1
b = 0
while a < 101:
b = a * a
a = a + 1
L.append(b)
print sum(L)
# -*- coding: utf-8 -*-

print '''静夜思

床前明月光,
疑是地上霜。
举头望明月,
低头思故乡。'''
print r'''"To be, or not to be": that is the question.
Whether it's nobler in the mind to suffer.'''
print 45678+0x12fd2

print "Learn Python in imooc"

print 100 < 99

print 0xff == 255
s = 'Python was started in 1989 by "Guido".\nPython is free and easy to learn.'
print s
s = 'Python was started in 1989 by "Guido".\nPython is free and easy to learn.'
print s
print [m*100+n*10+l for m in range(1,10) for n in range(0,10) for l in range(0,10) if m==l]
print(45678+0x12fd2)
print("Learn Python in imoo")
print(100 < 99)
print(0xff == 255)

已采纳回答 / qq_Closetou_0
当设置默认参数后,调用函数时如果没有传递参数,就按照默认参数输出。如果传递了参数,就覆盖原来的默认参数,输出你传递的参数
好像可以用'''吧。'''之间可以任意使用'和''。'''
说实话,我也是小白,可是看到这里就已经一头雾水了
python3 是打印不出来L[-4] de
print [int(x+y+z) for x in '123456789' for y in '0123456789' for z in '0123456789' if (x+y+z)==(z+y+x)]
课程须知
如果您了解程序设计的基本概念,会简单使用命令行,了解中学数学函数的概念,那么对课程学习会有很大的帮助,让您学起来得心应手,快速进入Python世界。
老师告诉你能学到什么?
通过本课程的学习,您将学会搭建基本的Python开发环境,以函数为基础编写完整的Python代码,熟练掌握Python的基本数据类型以及list和dict的操作。

微信扫码,参与3人拼团

微信客服

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

帮助反馈 APP下载

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

公众号

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

友情提示:

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

本次提问将花费2个积分

你的积分不足,无法发表

为什么扣积分?

本次提问将花费2个积分

继续发表请点击 "确定"

为什么扣积分?

举报

0/150
提交
取消