From 007b38751d1a59cac63e02a25d0d935dd9880ab3 Mon Sep 17 00:00:00 2001 From: Marc Wilson Date: Sat, 3 Sep 2022 09:38:19 -0700 Subject: [PATCH] add try/except to computer prompt, invalid input should not crash game --- 84_Super_Star_Trek/python/superstartrek.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/84_Super_Star_Trek/python/superstartrek.py b/84_Super_Star_Trek/python/superstartrek.py index 40ccb9f6..21e03e45 100644 --- a/84_Super_Star_Trek/python/superstartrek.py +++ b/84_Super_Star_Trek/python/superstartrek.py @@ -902,7 +902,10 @@ class Game: if len(command) == 0: com = 6 else: - com = int(command) + try: + com = int(command) + except ValueError: + com = 6 if com < 0: return