为了账号安全,请及时绑定邮箱和手机立即绑定
# Enter a codes='AABCDEFGHHIJ'
L=[75,92,59,68,99]
sum=0
for x in L:
sum=sum+x
print(sum/5)
s='ABCD'
print(s[0:4])
age=33
if age>18:
print('adult')
else:
if age>6:
print('teenager')
else:
if age>3:
print('kid')

else:
print('baby')
s='AABCDEFGHHIJ'
string=s[1:9]
print(string)
s='这是一句中英文混合的python字符串:Hello world'
print(s)
# Enter a code
template='{} is short,{} need {}'
nei='Life'
nei2='you'
nei3='python'
result=template.format(nei,nei2,nei3)
print(result)
# Enter a code
template='{2} is short,{0} need {1}'
nei='Life'
nei2='you'
nei3='python'
result=template.format(nei,nei2,nei3)
print(result)
d = {
'Alice': 45,
'Bob': 60,
'Candy': 75,
'David': 86,
'Ellena': 49
}
name=('Alice','Bob', 'Candy', 'Mimi','David')
for i in name:
print(i+':'+str(d.get(i)))
s1='ABC'
s2='123'
s3='XYZ'
for a in s1:
for b in s2:
for c in s3:
for x in [a,b,c]:
for y in [a,b,c]:
for z in [a,b,c]:
if x!=y and x!=z and y!=z:
print(x+y+z)
# Enter a code
# -*- coding:utf-8 -*-
a = 'AABCDEFGHHIJ'
g = a[1:9]
print(g)
# Enter a code
age = 23
if age>=18:
print('adult')
elif age<3:
print('baby')
elif age<6:
print('kid')
else:
print('teenager')
错了 输出偶数位置 应该是 if num % 2 == 0 :
# Enter a code
names = ['alice','bob','candy','david','ellena','gaven']
scores = [45,60,75,86,49,86]
index = 0
for name in names:
score = scores[index]
print('name = {},score = {}'.format(name,score))
index = index + 1
# Enter a code
L=['Alice', 'Bob', 'David', 'Ellena']
L.append('Gen')
L.append('Phoebe')
L.append('Zero')
print(L)
M=['Alice', 'Bob', 'David', 'Ellena']
M.insert(4,'Zero')
M.insert(4,'Phoebe')
M.insert(4,'Gen')
print(M)
# Enter a code
L=['Alice',66,'Bob',True,'False',100]
i=1
for item in L:
if(i%2==0):
print(item)
i=i+1
课程须知
如果您了解程序设计的基本概念,会简单使用命令行,了解中学数学函数的概念,那么对课程学习会有很大的帮助,让您学起来得心应手,快速进入Python世界。
老师告诉你能学到什么?
通过本课程的学习,您将学会搭建基本的Python开发环境,以函数为基础编写完整的Python代码,熟练掌握Python的基本数据类型以及list和dict的操作,灵活使用流程控制语句。

微信扫码,参与3人拼团

微信客服

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

帮助反馈 APP下载

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

公众号

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

友情提示:

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

本次提问将花费2个积分

你的积分不足,无法发表

为什么扣积分?

本次提问将花费2个积分

继续发表请点击 "确定"

为什么扣积分?

举报

0/150
提交
取消