Commit b2a1a4b8 by BellCodeEditor

save project

parent 645755f7
Showing with 28 additions and 15 deletions
# 古代测量臂力是靠不同重量的石锁,只能测整数哦。
# 最小的石锁是30公斤最大的石锁是100公斤,注意输入的数字哦。
# 请优化刚刚的代码,并增添交互效果,和自动输出最强三人信息的功能~
# 问询处
# 归档处
hero=['赵一',30,'丁二',37,'孙五',52,'王猛',89,'周亮',98,'张宇',100]
for i in range(len(hero)):
# 打印出臂力最强的三个人和他们对应的臂力值:
#关羽温酒斩华雄,但毕竟华雄是董卓这边的猛将,董卓得知后,大怒,派吕布前往虎牢关对战.
#关羽温酒斩华雄,但毕竟华雄是董卓这边的猛将,董卓得知后,大怒,派吕布前往虎牢关对战.
#吕布勇不可挡,接连杀败八路诸侯。
#一天,他又来挑战,北平太守公孙瓒迎战吕布,没几个回合便败下阵来。
#张飞截住吕布连战五十回合不分胜负。
#关羽见张飞不能取胜,便上前助战,刘备见两个兄弟战不下吕布,也挥动双股剑上前助战.
#终于将吕布打败了。这就是史上有名的三英战吕布。
# 省略繁杂情节,刘关张三人一起冲入战场,围攻吕布:
a=['吕布']
b=['袁术','公孙瓒','关羽','张飞','刘备','曹操']
a.extend(b[2:5])
print(a)
# 切片的用法,请你和小伙伴讲讲吧:
# 就像切片面包一样,列表切片也是这样,可以取连续多个元素,秉承着“取左不取右,不写全都取”的原则。
\ No newline at end of file
name='刘强'
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
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