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

初识Python

廖雪峰 移动开发工程师
难度入门
时长 5小时 0分
学习人数
综合评分9.43
3762人评价 查看评价
9.7 内容实用
9.4 简洁易懂
9.2 逻辑清晰
def generate_tr(name, score):
if score>60:
return '<tr><td>%s</td><td>%s</td></tr>' % (name, score)
else:
return '<tr><td>%s</td><td style="color:red">%s</td></tr>' % (name, score)

tds = [generate_tr(name, score) for name, score in d.iteritems()]
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
x1 = 1
d = 3
n = 100
x100 = x1+(n-1)*d
s = (x1+x100)*n/2
print s

已采纳回答 / Eason_Wang
#先执行for 循环,比如这里是先:for x in range(100, 1000)    #接下来是循环内部的判断,我们通过添加 if 判断语句,打算只添加符合要求的选项    if x/100 == x%10:    # x/100 表示取最高位有效数字, x%10 表示取各位,或最低位有效数字        #在if 满足的情况下,把这个数加进列表 list,         #这里等价于print [x for x in range(100,1000) if x/100 ==x%10] 中的第一...
汉罗塔 递归函数
RCT
若打开 f盘
cd /d f:\
s = set(str.lower(item) for item in ['Adam', 'Lisa', 'Bart', 'Paul'])
print 'adam' in s
print 'bart' in s
安装前面学的,for循环里不应该是 x in average 吗?
sum = 0
x = 0
while True:
x = x + 1
if x > 100:
break
if x%2:
sum = sum + x
else:
continue
print sum

已采纳回答 / weibo_明明快死了仍然装作很_033
if n == 1    return 1这一步就是对于fact(1)的赋值
#-*-coding:utf-8-*-
L = [95.5,85,59]
print ("第一名是:"str(L[0]))
print ("第二名是:"str(L[1]))
print ("第三名是:"str(L[1]))
print ('this is list 集合。')
L = []
for x in range(1,10):
for y in range(10):
for z in range(10):
if x == z:
L.append(x*100+y*10+z)
print L
注意*号
x1 = 1
d = 3
n = 100
x100 = x1+(n-1)*d
s = n*(x1+x100)/2
print s
def greet(content = 'world'):
print 'hello,',content,'.'

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

微信扫码,参与3人拼团

微信客服

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

帮助反馈 APP下载

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

公众号

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

友情提示:

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

本次提问将花费2个积分

你的积分不足,无法发表

为什么扣积分?

本次提问将花费2个积分

继续发表请点击 "确定"

为什么扣积分?

举报

0/150
提交
取消