Exception handling | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson

Exception handling

try: def labas(x): xx = 0 for i in range(x): xx += i return xx print(labas(5)) except IndentationError: print("code error") As sample this code I wrote wrong in purpose. So by try and except statements I should get output 'code error', but I didn't get any output. How these statement are works? Should I proper name except statement, with proper mistake name? I f yes what purpose of these statements? If I know what I'm doing wrong and what mistake I gonna do. I don't know is it my question is clear. Thanks

25th Apr 2020, 4:54 PM
Sigitas S
Sigitas S - avatar
1 Answer
+ 1
I also checked and was wondering what was happening ,so this is it if I am not wrong! https://www.tutorialspoint.com/How-to-catch-IndentationError-Exception-in-JUMP_LINK__&&__python__&&__JUMP_LINK
25th Apr 2020, 5:37 PM
Abhay - avatar