为了账号安全,请及时绑定邮箱和手机立即绑定
L = ['Alice', 'Bob', 'Candy', 'David', 'Ellena']
N = [89,72,88,79,99]
dictA=dict(zip(L,N))
dictB=sorted(dictA, key=dictA.get, reverse = True)
print(dictB)

最赞回答 / 慕仙9354813
首先,s,d是定义在sub_sum()这个函数中的,这个函数对外只有l一个参数。当sub_sum()这个函数定义结束时,外部是无法访问内部的s,d如果你想打印s和d,要改成这样:def sub_sum(l):    s=0    d=0    for i in l:        if i%2==0:            s=s+i        else:            d=d+i        i=i+1    print(s)    print(d)l=[1,2,3,4,5,6,7,8,9...
你见过我的好朋友Gaven吗,他是个英国人,他不见了

最新回答 / 慕运维0295976
第二种更简洁,少用了world,china,beijing,imooc这几个变量,所以第二种更好更快更易懂吧。
# Enter a code
lengh = 3.14
wide = 1.57
squre = lengh * wide
print(round(squre, 2))
# Enter a code
lengh = 3.14
wide = 1.57
squre = lengh * wide
print(round(wide, 2))
l=['Alice', 'Bob', 'Candy', 'David', 'Ellena']
l[0]='Ellena'
l[1]='Alice'
l[-1]='Bob'
print(l)
print(r'''"To be, or not to be": that is the question.
Whether it's nobler in the mind to suffer.''')

print('\"To be, or not to be\": that is the question.\nWhether it\'s nobler in the mind to suffer.')
# 方法1
list = [i ** 2 for i in range(1, 10)]
print(sum(list))

# 方法2

list2 = [*range(1, 10)]


def square_of_sum(list):
sum = 0
for num in list:
sum += num**2

return sum


sum = square_of_sum(list2)
print(sum)
# 方法1
list = [i**2 for i in range(1,10)]
print(sum(list))

# 方法2

list2 = [*range(1,10)]

def square_of_sum(list):
sum = 0
for num in list:
sum += num

return sum

sum = square_of_sum(list2)
print(sum)
l = [i*i for i in range(1,101)]
print(sum(l))

最赞回答 / gogogo
适当收费是可以的,哪能让你一辈子都白嫖
a or 'world'(True or True=True)
b or 'world'(False or True=True)
应该是:print(hello+space+world)

最新回答 / qq_桜散時_0
函数return 没有返回值啊你直接在函数体内输出了
课程须知
如果您了解程序设计的基本概念,会简单使用命令行,了解中学数学函数的概念,那么对课程学习会有很大的帮助,让您学起来得心应手,快速进入Python世界。
老师告诉你能学到什么?
通过本课程的学习,您将学会搭建基本的Python开发环境,以函数为基础编写完整的Python代码,熟练掌握Python的基本数据类型以及list和dict的操作,灵活使用流程控制语句。

微信扫码,参与3人拼团

微信客服

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

帮助反馈 APP下载

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

公众号

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

友情提示:

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

本次提问将花费2个积分

你的积分不足,无法发表

为什么扣积分?

本次提问将花费2个积分

继续发表请点击 "确定"

为什么扣积分?

举报

0/150
提交
取消