From fec1d1277a7a529e75f9d8c45e6b8354319d9fdc Mon Sep 17 00:00:00 2001 From: Kirill Date: Thu, 29 Apr 2021 10:48:29 +0600 Subject: [PATCH] Fix: if user input is not a number app crashes --- main.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 39c55e5..5589c6e 100644 --- a/main.py +++ b/main.py @@ -7,7 +7,10 @@ def main(): terms_count = -1 lang = "-" while terms_count < 1 or terms_count > 500: - terms_count = int(input("Колличество терминов (1-500): ")) + try: + terms_count = int(input("Колличество терминов (1-500): ")) + except ValueError: + continue while lang.lower() != "рус" and lang.lower() != "каз": lang = input("Язык(РУС/каз): ") if lang.strip() == "":