From bcedb63577bba28fef4b2a91717ec688ca158d72 Mon Sep 17 00:00:00 2001 From: BellCodeEditor <bellcode_dev@bell.ai> Date: Sat, 20 Aug 2022 11:27:49 +0800 Subject: [PATCH] save project --- diy.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/diy.py b/diy.py index 2348563..40b2098 100644 --- a/diy.py +++ b/diy.py @@ -3,12 +3,16 @@ # 请优化刚刚的代码,并增添交互效果,和自动输出最强三人信息的功能~ # 问询处 - - +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:]) -- libgit2 0.25.0