mirror of
https://github.com/c0de-archive/hacktoberfest-2018.git
synced 2024-12-21 21:02:40 +00:00
Added useful Python file for checking input data
You can experiment with this file, add smth to it and use in your modules. Example of usage: >>>123 >>>Correct! >>>fsda12 >>>ValueError >>> >>>Enter something
This commit is contained in:
parent
4da95e9a22
commit
5924cea46f
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