PYTHON仅一个for循环,一个while循环,为撒还是RUNTIME
查看原帖
PYTHON仅一个for循环,一个while循环,为撒还是RUNTIME
455198
Hang_24楼主2021/4/2 20:06

textlist=[] end = 'E' while True: text=input() textlist += text if textlist[-1] == end: break textlist.pop()

tw=0 tl=0 pw=0 pl=0 p=[] for i in textlist: if i == 'W': tw+=1 pw+=1 if i == 'L': tl+=1 pl+=1 if (tw==11 or tl==11) and (abs(tw-tl))>=2: print('%d:%d'%(tw,tl)) tw=0 tl=0 if (pw==21 or pl==21) and (abs(tw-tl))>=2: p.append('%d:%d'%(pw,pl)) pw=0 pl=0 print('%d:%d\n'%(tw,tl)) for i in p: print(i) print('%d:%d'%(pw,pl))

2021/4/2 20:06
加载中...