+ 1
Indentation
I think the indentation of «raise» in the example try except it's wrong. Somebody can confirm that?
5 odpowiedzi
+ 2
Hello,
It is not wrong.
The lesson wants to show you how to raise an error of your choice inside the "except" section... That's why the indentation...
+ 1
There must be indentation.
In python the indentation is similar to the {} in other codes... It means that the command is inside thr function. Hence, since you want to raise the error only if we are INSIDE the exception, the raise should be indented.
Hope I helped ^_^
0
Thank you for responding. What I meant is that in the example explanation there is no indentation but when you run it there is an indentation. Which is the correct one?
0
yes there is indentation, the raise should be put down under print() in above example.
and if you worrying about the output error, so don't..
it is expected by the code to raise the exception.
0
Can someone explain about if statements and indentation with an example.?