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

初识Python

廖雪峰 移动开发工程师
难度入门
时长 5小时 0分
学习人数
综合评分9.43
3762人评价 查看评价
9.7 内容实用
9.4 简洁易懂
9.2 逻辑清晰
在安装的时候就有个选项是添加到环境变量

最赞回答 / Yolanda2016
while循环中没有往L中添加元素,先创建一个空list,然后再在while循环中向list中添加n*n,可以用append函数实现
这个不对?输入显示:IndentationError: expected an indented block?? 还有如果不输入【list】这个括号就是错误而无序的吗

​months = set(["Feb","Jau","Mar","Apr","May"]) x = "monday" if x in months: print "x: ok" else: print "x:error"
print r'''"To be, or not to be": that is the question.
Whether it's nobler in the mind to suffer.'''

print '\"To be, or not to be\": that is the question.\nWhether it\'s nobler in the mind to suffer.'
s = 'Python was started in 1989 by "Guido".\nPython is free and easy to learn.'
print s

最新回答 / 筱兵潇将
所有程序----附件----命令提示符
print('hello,python')
print('hello,'+'python')
print 'hello,python'
print 'hello,','python'
输出
hello,python
hello,python
hello,python
hello, python 相对而言,第二种方法多出了一个空格
既然是官网下载的python,为什么不用python的IDE??
终于学完了,还要加紧练习,继续学习!
for x in range(1,10):
for y in range(0,10):
if x < y:
print x*10+y

#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 x*10 + y
print 2.5 + float(10) / 4
强制转换成浮点型也可以。。
print r'''"To be,or not to be":that is the question.
Whether it's nobler in the mind to suffer.'''
终于对了,分享一下
s = 'Python was started in 1989 by \"Guido\".\nPython in free and easy to learn.'
这样写怎么就不对了。。。
为啥我想了个最蠢的办法。。直接L=[1*1,2*2,...,100*100]中间那三个???看的懵逼了

最新回答 / livebetter
变量间复制,可变对象是引用,不可变是值copy(新生成值空间,不是变量对象空间).建议阅读链接:http://blog.csdn.net/longshenlmj/article/details/13773977

已采纳回答 / mosso
sum =0x = 0while True:    x = x + 1    if x%2==0:        continue    sum = sum +x    if x>100:        breakprint sum你把 if x>100:放在后面当x=101后程序已经执行了求和,在来执行判断。所以多加了101.
课程须知
如果您了解程序设计的基本概念,会简单使用命令行,了解中学数学函数的概念,那么对课程学习会有很大的帮助,让您学起来得心应手,快速进入Python世界。
老师告诉你能学到什么?
通过本课程的学习,您将学会搭建基本的Python开发环境,以函数为基础编写完整的Python代码,熟练掌握Python的基本数据类型以及list和dict的操作。

微信扫码,参与3人拼团

微信客服

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

帮助反馈 APP下载

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

公众号

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

友情提示:

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

本次提问将花费2个积分

你的积分不足,无法发表

为什么扣积分?

本次提问将花费2个积分

继续发表请点击 "确定"

为什么扣积分?

举报

0/150
提交
取消