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

最新回答 / qq_迷失在天堂里云_0
remove函数只能删除首个满足条件的数,不如换种方式
c=[2,5,2,3,3,4,8,'a','b','c','d',1.1]
c2=[]
for t in c:
    if  isinstance(t,float) or isinstance(t,int):
        c2.append(t)
print(c2)

最新回答 / 四饼同学
r'''...'''会对'''...'''中的内容进行转义单独的'''...''',就只是一个换行的作用<...图片...>

最新回答 / 慕无忌7227368
# Enter a coded = {'Alice': [50, 61, 66], 'Bob': [80, 61, 66], 'Candy': [88, 75, 90]}for key in d.keys():    for score in d[key]:        print(key, score)    
# coding=utf-8

d = {'Alice': [50, 61, 66], 'Bob': [80, 61, 66], 'Candy': [88, 75, 90]}
template = "{}的第{}次成绩是{}分"
for key, value in d.items():
for index in range(len(value)):
print(template.format(key,index+1,value[index]))

最赞回答 / 慕前端6152346
可能是b=' '?单引号之间输入了空格,输出的是hello,如果是b='',单引号没有空格,输出的是hello,world
不是表面积吗
special string:',",\,\\,\n,\t
print "special string: \', \",\\, \\\\, \\n, \\t"
a = 'python'
print 'hello,', a or 'world'
b = ''
print 'hello,', b or 'world'

a为有效字符串,即为true; 则 = true
b为空字符串,即为false; 则 = false

已采纳回答 / weixin_慕沐9146932
year = '今年 {} 岁'age = 19if age >= 18:    print(year.format(age))

最赞回答 / 大象无形呀
\表示转义字符,\后面紧接的1个字符表示普通的一个符号,不再是python中特殊字符了
def greet(c='World'):
print('hello'+','+c)
return
greet()
greet('sb')
# coding=utf-8
#请分别使用循环和递归的形式定义函数,求出1~100的和。
#循环
def sum(n):
i=0
s=0
while i<=n:
s=s+i
i=i+1
print(s)
return


sum(100)
#递归
def he(n):
x=0
if n==1:
x=n
else:
x=he(n-1)+n
return x
print(he(100))
# coding=utf-8
def sub_sum(L):
y=0
j=0
i=0
while i<len(L):
if i%2==0:
y=y+L[i]
else:
j=j+L[i]
i=i+1
print(y,j)
return
sub_sum([1,2,3,4])

最赞回答 / Yokk
因为你的greet函数中没有return任何东西,所有print(greet())相当于 print(None)
课程须知
如果您了解程序设计的基本概念,会简单使用命令行,了解中学数学函数的概念,那么对课程学习会有很大的帮助,让您学起来得心应手,快速进入Python世界。
老师告诉你能学到什么?
通过本课程的学习,您将学会搭建基本的Python开发环境,以函数为基础编写完整的Python代码,熟练掌握Python的基本数据类型以及list和dict的操作,灵活使用流程控制语句。

微信扫码,参与3人拼团

微信客服

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

帮助反馈 APP下载

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

公众号

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

友情提示:

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

本次提问将花费2个积分

你的积分不足,无法发表

为什么扣积分?

本次提问将花费2个积分

继续发表请点击 "确定"

为什么扣积分?

举报

0/150
提交
取消