题解 | #坐标移动#
坐标移动
https://www.nowcoder.com/practice/119bcca3befb405fbe58abe9c532eb29
moves = input().split(";") x, y = 0, 0 def move(direction, steps): global x, y if direction == "A": x -= steps elif direction == "D": x += steps elif direction == "W": y += steps elif direction == "S": y -= steps for move_str in moves: if len(move_str) > 1 and move_str[1:].isdigit(): move(move_str[0],int(move_str[1:])) print(f'{x},{y}')