Commit 0349f03a by BellCodeEditor

auto save

parent c593e827
Showing with 44 additions and 10 deletions
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)
break
print(hero)
\ No newline at end of file
# 古代测量臂力是靠不同重量的石锁,只能测整数哦。
# 最小的石锁是30公斤最大的石锁是100公斤,注意输入的数字哦
# 问询处
name=input('你叫啥名啊?')
power=int(input('你臂力多少啊?'))
# 归档处
hero=['赵一',30,'丁二',37,'孙五',52,'王猛',89,'周亮',98,'张宇',100]
for i in range(len(hero)):
if i%2==1 and hero[i]>=power:
hero.insert(i-1,name)
hero.insert(i,power)
break
print(hero[-6:])
\ No newline at end of file
# 勇于挑战的创造师,请运行这段代码,看看能不能将颜良、文丑加入战场? name='刘强'
a= ['华雄'] power=66
a.append('颜良','文丑') hero=['赵一',30,'丁二',37,'孙五',52,'王猛',89,'周亮',98]
print(a) for i in range(len(hero)):
if i%2==1 and hero[i]>=power:
hero.insert(i-1,name)
hero.insert(i,power)
break
print(hero)
\ No newline at end of file
# 勇于挑战的创造师,请运行下面的代码,观察运行结果,和小伙伴们说说你的发现? i in range(len(hero)):
a= ['华雄'] if i%2==1 and hero[i]>=power:
c=['颜良','文丑'] hero.insert(i-1,name)
a.extend(c) hero.insert(i,power)
print(a) break
\ No newline at end of file print(hero)name='刘强'
power=66
hero=['赵一',30,'丁二',37,'孙五',52,'王猛',89,'周亮',98]
for
\ 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