- 乒乓球
- 2019-08-01 11:27:58 @
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类型的数据,不可将两者混合运算