题解 | 坐标移动
坐标移动
https://www.nowcoder.com/practice/119bcca3befb405fbe58abe9c532eb29
oder_list = input().split(';')
codinate = [0,0]
for item in oder_list:
if not 2 <= len(item) <=3:
continue
try:
direction = item[0]
step = item[1:]
if direction in ['A','W','D','S']:
if 0 < int(step) <= 99:
if direction == 'A':
codinate[0] -=int(step)
if direction == 'D':
codinate[0] += int(step)
if direction == 'W':
codinate[1] +=int(step)
if direction == 'S':
codinate[1] -=int(step)
except:
continue
print(str(codinate[0])+','+str(codinate[1]))
