Commit 602d3bc7 by BellCodeEditor

save project

parent 6d2eb407
Showing with 25 additions and 6 deletions
students=["悟空","小贝","八戒","波奇"]
students.pop(2)
students.append("诺依")
print(students)
red=students[0:2]
blue=students[2:5]
print(red)
print(blue)
# 臂力挑战赛 # 臂力挑战赛
# 快用你机灵的小脑瓜想想,如何将刘强和他的臂力值自动插入到hero列表中? # 快用你机灵的小脑瓜想想,如何将刘强和他的臂力值自动插入到hero列表中?
name='刘强' name=input("你叫啥")
a='是臂力大王。' a='是臂力大王。'
power=66 power=int(input("你臂力多少"))
hero=['周亮',98,'王猛',89,'孙五',52,'丁二',37,'赵一',30] hero=['赵一',30,'丁二',37,'孙五',52,'王猛',89,'周亮',98]
# 自动排序 # 自动排序
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]>=power:
hero.insert(i-1,name) hero.insert(i-1,name)
hero.insert(i,power) hero.insert(i,power)
break break
hero.insert(6,a) hero.append(a)
print(hero[0:7]) print(hero[-7:])name=input("你叫啥")
a='是臂力大王。'
power=int(input("你臂力多少"))
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)
break
hero.append(a)
print(hero[-7:])
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