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

初识Python

廖雪峰 移动开发工程师
难度入门
时长 5小时 0分
学习人数
综合评分9.43
3762人评价 查看评价
9.7 内容实用
9.4 简洁易懂
9.2 逻辑清晰
#print 'hello'
print 'hello,python'
print "hello,python"
print 45678 + 0x12fd2
print 'Learn Python in imooc'
print 100 < 99
print 0xff == 255
>>> print (u'''静夜思

床前明月光,
疑是地上霜。
举头望明月,
低头思故乡。''')
静夜思

床前明月光,
疑是地上霜。
举头望明月,
低头思故乡。

其实3.4挺好的……
# -*- coding: utf-8 -*-

print r'''静夜思

床前明月光,
疑是地上霜。
举头望明月,
低头思故乡。'''
int start=1;//起始项是1
int sum=1;//当只有一项时和为1
for(int l=1;l<=3;l++){
start=start+3;//获取每项的值
sum=start+sum;//将每项的值加到sum中去
}
System.out.println(sum);
Python 3.4.3
>>> print ('\'\\"To be, or not to be\\": that is the question.\\nWhether it\\\'s nobler in the mind to suffer.\'')
'\"To be, or not to be\": that is the question.\nWhether it\'s nobler in the mind to suffer.'
别问我……我整个人都是奔溃的……
>>> print r'''''\'\'to be, or not to be\":that is the question.\nWhether it\'s nobler in the mind to suffer.\''''''
''\'\'to be, or not to be\":that is the question.\nWhether it\'s nobler in the mind to suffer.\'
Python 2.7.11
>>> print r'''\'to be, or not to be\":that is the question.\nWhether it\'s nobler in the mind to suffer.'''
\'to be, or not to be\":that is the question.\nWhether it\'s nobler in the mind to suffer.
1.x从1--100开始递增
2.判断x是否在100范围中
3.判断x是否为奇数
是:递加到sum变量中
否:跳过后面语句
continuc继续循环 这个标题怎么复制到这里就变成了continue继续循环 错字有点多呀 注意点吧
sum = 0
x = 1
while x<=100:
sum=sum+x
x=x+2
print sum
Truc? 是True吧
我都是蒙的 还都蒙对了 可我还是不会 晕

最新回答 / 毛线快跑
# -*- coding: utf-8 -*-print '''静夜思床前明月光,疑是地上霜。举头望明月,低头思故乡。'''不用加u 就过了。。。
我只是说,这种排序有点扯淡。。。。。,
课程须知
如果您了解程序设计的基本概念,会简单使用命令行,了解中学数学函数的概念,那么对课程学习会有很大的帮助,让您学起来得心应手,快速进入Python世界。
老师告诉你能学到什么?
通过本课程的学习,您将学会搭建基本的Python开发环境,以函数为基础编写完整的Python代码,熟练掌握Python的基本数据类型以及list和dict的操作。

微信扫码,参与3人拼团

微信客服

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

帮助反馈 APP下载

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

公众号

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

友情提示:

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

本次提问将花费2个积分

你的积分不足,无法发表

为什么扣积分?

本次提问将花费2个积分

继续发表请点击 "确定"

为什么扣积分?

举报

0/150
提交
取消