Error / Exception
Në shqip: Gabim / përjashtim
ShpjegimiSQ
Error-i (ose exception) është mesazhi që jep programi kur has diçka që s'mund ta bëjë, p.sh. pjesëtim me zero. Nëse nuk e trajton, programi ndalet; me try/except mund ta kapësh dhe të vazhdosh.
EnglishEN
An error (or exception) is the message a program gives when it hits something it can't do, like dividing by zero. If you don't handle it, the program stops; with try/except you can catch it and carry on.
Si ta mendosh
Si kur gjyqtari fishkëllen për faull: loja ndalet. Por nëse ekipi e ka gati planin (gjuajtjen e lirë), loja rifillon pa problem.
Lexoje në anglisht
Like the referee blowing for a foul: play stops. But if the team has a plan ready (the free kick), the game restarts without trouble.
Shembull kodipython
try:
rezultati = 10 / 0
except ZeroDivisionError:
print("Nuk mund të pjesëtosh me zero!")