diff --git a/snake.py b/snake.py index 1c0f1d6..fa5f6fe 100755 --- a/snake.py +++ b/snake.py @@ -287,10 +287,7 @@ def get_input(self) -> Direction: return Direction.NONE if key == -1: # no key provided return self._direction - try: - return keys[key] - except KeyError: - return Direction.NONE + return keys.get(key, Direction.NONE) def get_new_head(self) -> Location: """Return the location of the snake's new head"""