+ 1
Raising errors
print(1) raise ValueError print(2) ---------------- This says we can raise errors. But why do we need to raise errors? I mean we should try that no error occurs, then why tp raise them intentionally?
3 ответов
+ 2
Let's say you create a programme this programme can only use those people who has age greater than 18.if someone use your programme who has age less than 18 then it will raise error value error or you can choose your own name for exception like age error.so children's cannot use this programme.
+ 2
Its helpful for debugging for developers and to show a not-so-geeky error to users when something wrong happens.
Now when you're writing codes and running it, you get some errors bcz they're raised explicitly at the backend to make it easier for you to debug it.
0
Maybe useful for something🏃