题解 | #坐标移动#
坐标移动
http://www.nowcoder.com/practice/119bcca3befb405fbe58abe9c532eb29
location = input().split(';') row = 0 column = 0 pos = 'ADWS' while '' in location: location.pop(location.index('')) while location: value = location.pop(0) if not value[1:].isnumeric(): # 保证第2~3位置为数字 continue elif value[0] not in pos: continue else: if value[0] == 'A': row -= int(value[1:]) elif value[0] == 'D': row += int(value[1:]) elif value[0] == 'W': column += int(value[1:]) elif value[0] == 'S': column -= int(value[1:]) print(str(row) + ',' + str(column))