Commit cad3e7ce by BellCodeEditor

save project

parent 1bb57bd5
Showing with 8 additions and 8 deletions
# 臂力挑战赛 name=input('名字:')
# 快用你机灵的小脑瓜想想,如何将刘强和他的臂力值自动插入到hero列表中? power=input('臂力:')
name='李'
power=56
hero=['肖',22,'许',26,'吕',32,'白',50,'周',65] hero=['肖',22,'许',26,'吕',32,'白',50,'周',65]
# 自动排序 # 自动排序
for i in range(len(hero)): for i in range(len(hero)):
if i%2==1 and hero[i]>=power: if i%2==1 and hero[i]>=int(power):
hero.insert(i-1,name) hero.insert(i-1,name)
hero.insert(i,power) hero.insert(i,int(power))
print(hero) break
\ No newline at end of file print(hero)
print(hero[len(hero)-6:])
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment