From 93d782edb63b4b69867a3714ba9f763fb14356ec Mon Sep 17 00:00:00 2001 From: BellCodeEditor <bellcode_dev@bell.ai> Date: Sat, 28 Oct 2023 14:36:37 +0800 Subject: [PATCH] save project --- diy.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/diy.py b/diy.py index 2348563..25cfe5f 100644 --- a/diy.py +++ b/diy.py @@ -1,15 +1,19 @@ # 古代测量臂力是靠不同重量的石锁,只能测整数哦。 # 最小的石锁是30公斤最大的石锁是100公斤,注意输入的数字哦。 # 请优化刚刚的代码,并增添交互效果,和自动输出最强三人信息的功能~ - +import random # 问询处 - - +name="朵拉" +power=random.randint(30,100) # 归档处 hero=['赵一',30,'丁二',37,'孙五',52,'王猛',89,'周亮',98,'张宇',100] for i in range(len(hero)): - - + if 1%2==1 and hero[1]>=power: + hero.insert(i-1,name) + hero.insert(i,power) + break +print(hero) # 打印出臂力最强的三个人和他们对应的臂力值: +print(hero[-6:]) \ No newline at end of file -- libgit2 0.25.0