From eee959ab660ad70183e7f401649f1fcaea3ba969 Mon Sep 17 00:00:00 2001 From: BellCodeEditor <bellcode_dev@bell.ai> Date: Sat, 23 Apr 2022 18:31:19 +0800 Subject: [PATCH] save project --- diy.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/diy.py b/diy.py index 2348563..8e2564f 100644 --- a/diy.py +++ b/diy.py @@ -3,13 +3,14 @@ # 请优化刚刚的代码,并增添交互效果,和自动输出最强三人信息的功能~ # 问询处 - - +name=input("请输入您的名字:") +porwer=int(input("请输入臂力值:")) # 归档处 hero=['赵一',30,'丁二',37,'孙五',52,'王猛',89,'周亮',98,'张宇',100] for i in range(len(hero)): - - - - + if i%2==1 and porwer<=hero[i]: + hero.insert(i-1,name) + hero.insert(i,porwer) + break # 打印出臂力最强的三个人和他们对应的臂力值: +print(hero[-6:]) \ No newline at end of file -- libgit2 0.25.0