Add details in python answer about error handling.

This commit is contained in:
surister 2020-01-20 16:17:46 +01:00 committed by GitHub
parent 66cb4deacf
commit 89aa001497
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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.")
``` ```