diff --git a/code/try_except.py b/code/try_except.py new file mode 100644 index 0000000..0133c7f --- /dev/null +++ b/code/try_except.py @@ -0,0 +1,14 @@ +while True: + line = input() + + if line: + try: + a = int(line) + print("Correct!") + exit(0) + except ValueError as vr: + print("Value Error:",vr) + continue + else: + print("Enter something") + continue