mirror of
https://github.com/c0de-archive/hacktoberfest-2018.git
synced 2024-11-16 01:07:26 +00:00
Merge pull request #205 from damoklov/master
Added try_except.py file for input checking
This commit is contained in:
commit
19442456ea
14
code/try_except.py
Normal file
14
code/try_except.py
Normal 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
|
Loading…
Reference in New Issue
Block a user