WeCodeAcademy

Handling Errors

Errors stop your program. try and except let you handle them.

Examplepython
Open in editor »
Quick check

Which keyword catches an error?

Your turn: write the code

Try to turn "abc" into an integer with int(). If it fails with a ValueError, print bad number. Always print done at the end (use finally).

Finish the quick check (and any code exercise) to complete this lesson, or mark it done yourself.

Tip: use the left and right arrow keys to move between lessons.