A Tsang A Tsang - 1 year ago 109
Python Question

How to create custom error handling in python?

i = 0
numbers = ["1","1","1","1","1"]
while 0 == 0:

Once finished it would say out of index/range. How would I get it to say ran out of numbers instead of an error?

I think it's called error handling.

Answer Source

You can handle errors using try and except

except Exception:
   print("ran out of numbers")
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download