为了账号安全,请及时绑定邮箱和手机立即绑定
print("这是一句中英文混合的%s字符串:%s"%("python","Hello\tWorld"))
template1="Life is short"
template2="you need python"
print("{0},{1}".format(template1,template2))

template="{L},{y}"
L="life is short"
y="you need python"
print(template.format(L=L,y=y))
print(r'''"To be, or not to be":that is the question
Whether it's nobler in the mind to suffer.''')
要用print输出才可以

已采纳回答 / 小白白白净
遍历过程中对集合 s 执行 remove 和 add 操作会导致集合 s 的 size 发生改变。即引发RuntimeError: Set changed size during iteration异常
L = ['Alice', 'Bob', 'Candy', 'David', 'Ellena']
S=[89, 72, 88, 79, 99]
Ss=[89, 72, 88, 79, 99]

def getnames(name):
return Ss.index(name)

S.sort(reverse=True);

for sa in S:
print(sa)

print(L[getnames(sa)])
print(r'''
''')

最新回答 / purplepearl
也就是说r''' '''是万能的,有包含任何特殊字符的字符串只要放在其中都不需要转义,只要用r''' '''就对了,是吧
a = 'python'
print('hello,'+( a or 'world'))
b = ''
print('hello,'+(b or 'world'))
L = [95.5, 85, 59, 66, 72]
L.sort(reverse=True)
for i in range(3):
print(L[i])

最新回答 / 慕圣6516049
set([])在你这里面是 没有元素set(b), b是一个非空数组,所以有元素打出来。如果 b=[], 那么就没区别了

最新回答 / 像一只狗
因为上面的b指向的是list,上面的print(sum)和下面就是一样的了

已采纳回答 / qq_林林小小_0
dict[key:value]一一对应,通过for循环语句遍历获取健值。通过这个代码可以一对一对的取出键值。

最新回答 / 子夜十分
Lift is short,you need PythonLift is short,you need Python
课程须知
如果您了解程序设计的基本概念,会简单使用命令行,了解中学数学函数的概念,那么对课程学习会有很大的帮助,让您学起来得心应手,快速进入Python世界。
老师告诉你能学到什么?
通过本课程的学习,您将学会搭建基本的Python开发环境,以函数为基础编写完整的Python代码,熟练掌握Python的基本数据类型以及list和dict的操作,灵活使用流程控制语句。

微信扫码,参与3人拼团

微信客服

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

帮助反馈 APP下载

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

公众号

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

友情提示:

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

本次提问将花费2个积分

你的积分不足,无法发表

为什么扣积分?

本次提问将花费2个积分

继续发表请点击 "确定"

为什么扣积分?

举报

0/150
提交
取消