Add details in python answer about error handling.
This commit is contained in:
parent
66cb4deacf
commit
89aa001497
@ -3244,9 +3244,8 @@ If user enter a non-integer value it will raise exception and using except it wi
|
|||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
a = int(input("please enter an integer value: "))
|
a = int(input("please enter an integer value: "))
|
||||||
print(a)
|
|
||||||
break
|
break
|
||||||
except:
|
except ValueError:
|
||||||
print("Ops! Please enter a valid integer value.")
|
print("Ops! Please enter a valid integer value.")
|
||||||
|
|
||||||
```
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user