課程
/后端開(kāi)發(fā)
/Python
/Python3 入門(mén)教程(新版)
L = ['Alice', 'Bob', 'Candy', 'David', 'Ellena']
L[0]='Ellena'
L[1]='Alice'
L[4]='Bob'
print(L)
2020-10-25
源自:Python3 入門(mén)教程(新版) 5-7
正在回答
# Enter a code
# coding:utf-8
names = ['Alice', 'Bob', 'Candy', 'David', 'Ellena']
scores = [89, 72, 88, 79, 99]
templateNames = []
templateScores = [89, 72, 88, 79, 99]
scores.sort(reverse=True)
print("降序排列后的成績(jī):" + str(scores))
index_Score = 0
index_TemplateScore = 0
for score in scores:
? ? index_TemplateScore = 0
? ? for templateScore in templateScores:
? ? ? ? if score == templateScore:
? ? ? ? ? ? templateNames.append(names[index_TemplateScore])
? ? ? ? index_TemplateScore += 1
print("排列后的名字:" + str(templateNames))
N = [89,72,88,79,99]
dictA=dict(zip(L,N))
dictB=sorted(dictA, key=dictA.get, reverse = True)
print(dictB)
慕俠1360900
qq_老老宋_0 回復(fù) 慕俠1360900
對(duì)的 不用全部替換
qq_謝謝惠顧_2
舉報(bào)
python3入門(mén)教程,讓你快速入門(mén)并能編寫(xiě)簡(jiǎn)單的Python程序
2 回答為啥倒敘是-3 卻把‘candy’替換掉了?
3 回答不用if不可以嗎?
1 回答python下載了 cmd顯示不是內(nèi)部和外部命令 也不是可運(yùn)行的程序
6 回答輸出為什么不可以是漢字
2 回答6-4的這個(gè)任務(wù),是不是這樣寫(xiě)也可以?
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號(hào)-11 京公網(wǎng)安備11010802030151號(hào)
購(gòu)課補(bǔ)貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動(dòng)學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號(hào)
2021-03-12
# Enter a code
# coding:utf-8
names = ['Alice', 'Bob', 'Candy', 'David', 'Ellena']
scores = [89, 72, 88, 79, 99]
templateNames = []
templateScores = [89, 72, 88, 79, 99]
scores.sort(reverse=True)
print("降序排列后的成績(jī):" + str(scores))
index_Score = 0
index_TemplateScore = 0
for score in scores:
? ? index_TemplateScore = 0
? ? for templateScore in templateScores:
? ? ? ? if score == templateScore:
? ? ? ? ? ? templateNames.append(names[index_TemplateScore])
? ? ? ? index_TemplateScore += 1
print("排列后的名字:" + str(templateNames))
2020-11-26
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)
2020-10-26
對(duì)的 不用全部替換