From c7d3a43abf1bfb776bed41915fc9c1567e5a6660 Mon Sep 17 00:00:00 2001 From: BellCodeEditor <bellcode_dev@bell.ai> Date: Tue, 5 Oct 2021 19:54:18 +0800 Subject: [PATCH] save project --- diy.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/diy.py b/diy.py index 2348563..1968f0a 100644 --- a/diy.py +++ b/diy.py @@ -3,13 +3,18 @@ # 请优化刚刚的代码,并增添交互效果,和自动输出最强三人信息的功能~ # 问询处 - +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 +h=hero[-6:] +print(h) # 打印出臂力最强的三个人和他们对应的臂力值: -- libgit2 0.25.0