Commit 9d2a4de3 by BellCodeEditor

auto save

parent 0db28b07
Showing with 21 additions and 2 deletions
# 臂力挑战赛
# 快用你机灵的小脑瓜想想,如何将刘强和他的臂力值自动插入到hero列表中?
name='刘强'
power=66
hero=['赵一',30,'丁二',37,'孙五',52,'王猛',89,'周亮',98]
......
name=[]
num=[]
i2=0
while True:
l_name=input("YOU NAME:")
l_num=input("YOU NUM:")
if l_name=='stop':
print(name)
print(num)
exit()
elif len(name)==0:
name.insert(0,l_name)
num.insert(0,l_num)
else:
for i in range(len(name)):
if l_num>num[i]:
i2=i+1
name.insert(i2,l_name)
num.insert(i2,l_num)
\ 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