Skip to content
  • P
    Projects
  • G
    Groups
  • S
    Snippets
  • Help

bellcode / lesson6-5-1

  • This project
    • Loading...
  • Sign in
Go to a project
  • Project
  • Repository
  • Issues 0
  • Merge Requests 0
  • Pipelines
  • Wiki
  • Snippets
  • Members
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Files
  • Commits
  • Branches
  • Tags
  • Contributors
  • Graph
  • Compare
  • Charts
Switch branch/tag
  • lesson6-5-1
  • diy.py
Find file
BlameHistoryPermalink
  • BellCodeEditor's avatar
    save project · 0625fafd
    BellCodeEditor committed 4 years ago
    0625fafd
diy.py 382 Bytes
1 2 3 4 5 6 7 8 9 10 11 12 13
# 臂力挑战赛
# 快用你机灵的小脑瓜想想,如何将刘强和他的臂力值自动插入到hero列表中?
name='刘强'
power=66
hero=['赵一',30,'丁二',37,'孙五',52,'王猛',89,'周亮',98]
# 自动排序
for i in range(len(hero)):
    if i%2==1 and hero[i]>=power:
        hero.insert(i-1,name)    
        hero.insert(i,power)
print(hero)
c=hero[-6:]
print(c)