Merge pull request #205 from damoklov/master

Added try_except.py file for input checking
This commit is contained in:
Luke Oliff 2018-10-08 08:36:00 -07:00 committed by GitHub
commit 19442456ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

14
code/try_except.py Normal file
View File

@ -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