题解 | #坐标移动#
坐标移动
https://www.nowcoder.com/practice/119bcca3befb405fbe58abe9c532eb29
import sys
input_list = input().split(';')
initial = [0,0]
for i in input_list:
if not 2 <= len(i) <= 3:
continue
try:
direction = i[0]
step = int(i[1:])
if direction in ['A','S','W','D']:
if 0 <= step <= 99:
if direction == 'A':
initial[0] -= step
elif direction == 'D':
initial[0] += step
elif direction == 'S':
initial[1] -= step
elif direction == 'W':
initial[1] += step
except:
continue
print(f'{initial[0]},{initial[1]}')
