为了账号安全,请及时绑定邮箱和手机立即绑定
Score = [['Chinses',92],['Math',75],['English',99]]
T = ('Alice', 'Bob', 'Candy', 'David', 'Ellena')
# 通过下标的方式访问元素
print(T[0]) # ==> Alice
print(T[4]) # ==> Ellena
# 切片
print(T[1:3]) # ==> ('Bob', 'Candy')
candy错了吧,应该是David吧
二进制前面加个0b
print('Hello World')
num = 3.14 * 1.57

print (round (num , 2))

round 需要嵌套在print里面
a = 'special string: \',\",\\,\\\\,\\n,\\t'
print(a)
直接使用 get 方法如果找不到默认返回 None 的特性,代码如下。
d = {
'Alice': 45,
'Bob': 60,
'Candy': 75,
'David': 86,
'Ellena': 49
}

names = ["Alice", "Bob", "Candy", "Mimi", "David"]

for name in names :
print(d.get(name))
∑在计算机里面怎么用?
print(r'''"To be, or not to be": that is the question.
Whether it's nobler in the mind to suffer.''')
题目要求是删除S中的元素
如果是删除L中的元素,这道题就会变得非常有趣了
print(‘hello world’)
方式1:
template='life {0}, {1} Python.'
a='is short'
b='you need'
result=template.format(a,b)
print(result)

方式2:
template='life {o}, {t} Python.'
one='is short'
two='you need'
result=template.format(o=one,t=two)
print(result)
d = {
'Alice': 45,
'Bob': 60,
'Candy': 75,
'David': 86,
'Ellena': 49
}
if 'Alice' in d:
d.pop('Alice')
print(d)
else:
print("don't have Alice")
课程须知
如果您了解程序设计的基本概念,会简单使用命令行,了解中学数学函数的概念,那么对课程学习会有很大的帮助,让您学起来得心应手,快速进入Python世界。
老师告诉你能学到什么?
通过本课程的学习,您将学会搭建基本的Python开发环境,以函数为基础编写完整的Python代码,熟练掌握Python的基本数据类型以及list和dict的操作,灵活使用流程控制语句。

微信扫码,参与3人拼团

微信客服

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

帮助反馈 APP下载

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

公众号

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

友情提示:

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

本次提问将花费2个积分

你的积分不足,无法发表

为什么扣积分?

本次提问将花费2个积分

继续发表请点击 "确定"

为什么扣积分?

举报

0/150
提交
取消