Commit aff446da by BellCodeEditor

auto save

parent 0db28b07
Showing with 11 additions and 12 deletions
# 臂力挑战赛 import pygame
# 快用你机灵的小脑瓜想想,如何将刘强和他的臂力值自动插入到hero列表中? from pygame import locals
name='刘强' pygame.init()
power=66 screen=pygame.display.set_mode(size=(800,600))
hero=['赵一',30,'丁二',37,'孙五',52,'王猛',89,'周亮',98] while True:
# 自动排序 pygame.event.get()
for i in range(len(hero)): for event in pygame.event.get():
if i%2==1 and hero[i]>=power: if event.type==locals.QUIT:
hero.insert(i-1,name) exit()
hero.insert(i,power)
print(hero) \ No newline at end of file
\ 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