亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

想把人名和成績綁定起來

想把人名和成績綁定起來,然后排序成績顯示名字,我感覺這才是正解吧,但是我不會做,有沒有帶佬給給參考

正在回答

3 回答

# Enter a code

name=['Alice', 'Bob', 'Candy', 'David', 'Ellena']?

names=['Alice', 'Bob', 'Candy', 'David', 'Ellena']?

score=[89,72,88,79,99]

scores=[89,72,88,79,99]

scores.sort()

y=0

for a in scores:

? ? x=0

? ? for b in score:

? ? ? ? if score[x]==scores[y]:

? ? ? ? ? ? names[y]=name[x]

? ? ? ? x+=1

? ? y+=1

print(names)


5 回復 有任何疑惑可以回復我~
#1

慕慕8366462

L = ['Alice', 'Bob', 'Candy', 'David', 'Ellena'] c = [89, 72, 88, 79, 99] for i in range(0, len(c)-1): for j in range(0,len(c)-1-i): if c[j] < c[j+1]: tempL =L[j+1] L[j+1] = L[j] L[j] = tempL print(L)
2021-07-13 回復 有任何疑惑可以回復我~

L = ['Alice', 'Bob', 'Candy', 'David', 'Ellena']

c = [89, 72, 88, 79, 99]

for i in range(0, len(c)-1):

? ? for j in range(0,len(c)-1-i):

? ? ? ? if c[j] < c[j+1]:

? ? ? ? ? ? temp =c[j+1]

? ? ? ? ? ? c[j+1] = c[j]

? ? ? ? ? ? c[j] = temp

? ? ? ? ? ? tempL =L[j+1]

? ? ? ? ? ? L[j+1] = L[j]

? ? ? ? ? ? L[j] = tempL? ? ? ??

print(c)

print(L)


0 回復 有任何疑惑可以回復我~

L = ['Alice', 'Bob', 'Candy', 'David', 'Ellena']

c = [89, 72, 88, 79, 99]

for i in range(0, len(c)-1):

? ? for j in range(0,len(c)-1-i):

? ? ? ? if c[j] < c[j+1]:

? ? ? ? ? ? tempL =L[j+1]

? ? ? ? ? ? L[j+1] = L[j]

? ? ? ? ? ? L[j] = tempL

print(L)


0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

想把人名和成績綁定起來

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號