python

score = ''
while True :
temp_in = input()
score += temp_in
if 'E' in temp_in:
break
a = 0
b = 0
for s in score:
if s == 'W':
a += 1
if s == 'L':
b += 1
if (a > 10 or b > 10) and ((a-b) > 1 or (b-a) > 1):
temp_out = str(a)+':'+str(b)
print(temp_out)
a = 0
b = 0
if s == 'E':
temp_out = str(a)+':'+str(b)
print(temp_out)
a = 0
b = 0
break

print('')

for s in score:
if s == 'W':
a += 1
if s == 'L':
b += 1
if (a > 20 or b > 20) and ((a-b) > 1 or (b-a) > 1):
temp_out = str(a)+':'+str(b)
print(temp_out)
a = 0
b = 0
if s == 'E':
temp_out = str(a)+':'+str(b)
print(temp_out)
a = 0
b = 0
break
给自己的提醒:
注意区分int类型和str类型的数据,不可将两者混合运算

0 条评论

目前还没有评论...

信息

ID
1217
难度
7
分类
字符串 点击显示
标签
递交数
18619
已通过
4248
通过率
23%
被复制
33
上传者