Skip to content

Commit

Permalink
Fix: if user input is not a number app crashes
Browse files Browse the repository at this point in the history
  • Loading branch information
cmd-E committed Apr 29, 2021
1 parent ef3cc56 commit fec1d12
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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() == "":
Expand Down

0 comments on commit fec1d12

Please sign in to comment.