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

初识Python

廖雪峰 移动开发工程师
难度入门
时长 5小时 0分
学习人数
综合评分9.43
3762人评价 查看评价
9.7 内容实用
9.4 简洁易懂
9.2 逻辑清晰
因为 a='python'是非空字符串,所以当计算a or 'world'时,a为true,则整个结果必定为true,所以print结果为hello,python;而b是空字符串,计算b or 'world'时,b为false,结果取决于'world',而'world'为true,所以print结果为hello,world。
因为10/4的结果是2,如果要让它得到5.0,那么式子应该是2.5+10.0/4

最新回答 / A11EN
程序上有些问题吧,怎么除以2?
def average(*args):
x=sum(args)
n=x/2
return n

print average()
print average(1, 2)
print average(1, 2, 2, 3, 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 is free and easy to learn.'
print s
x1 = 1
d = 3
n = 100
x100 = x1 + ( n - 1) * d
s = (x1 + x100) * n / 2
print s
#print 'hello'
#input code
print 'hello,python.'
print 'hello,','python.'
#Enter a code
print 45678 + 0x12fd2

print 'Learn Python in imooc'

print 100<99
print 0xff==255
print [int(str(x)+str(y)+str(x)) for x in range(1,10) for y in range(10) ]

我觉得这样写简单些啊
print r'''"To be, or not to be": that is the question.
Whether it's nobler in the mind to suffer.'''
题目 . 不能输出
sum = 0
x = 1
while x<=100:
x=x+2
print sum 这个对了我去

最赞回答 / 小猫过河
<...code...><...code...><...code...><...code...><...code...><...code...><...code...>
L = [95.5,85,59]
print L[0]
print L[1]
print L[2]
print L
Z正确答案
课程须知
如果您了解程序设计的基本概念,会简单使用命令行,了解中学数学函数的概念,那么对课程学习会有很大的帮助,让您学起来得心应手,快速进入Python世界。
老师告诉你能学到什么?
通过本课程的学习,您将学会搭建基本的Python开发环境,以函数为基础编写完整的Python代码,熟练掌握Python的基本数据类型以及list和dict的操作。

微信扫码,参与3人拼团

微信客服

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

帮助反馈 APP下载

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

公众号

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

友情提示:

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

本次提问将花费2个积分

你的积分不足,无法发表

为什么扣积分?

本次提问将花费2个积分

继续发表请点击 "确定"

为什么扣积分?

举报

0/150
提交
取消