0
Can we use “raise” statement outside the except block?
Yes / No? Why?
4 Antworten
+ 3
You can, but you should try and catch your errors. The whole point of raise is when you don't want to allow certain input.
If there's a program that takes input, but it should only take letters, and numbers were entered, python sees nothing wrong with this. There can be a check to see if any numbers were entered and if so, raise an error to say so
+ 2
Yes you can use it outside the except block.
Why? That's the way the programming language was written 😃
It is a good explanation given by Slick . To disallow certain events (inputs) from happening.
Here's a quick example of its usage
Happy Coding 😀
https://code.sololearn.com/cc37rZ3tw8AN/?ref=app
+ 1
I get it now! 🤦🏾♂️
thank you Slick 👍🏽
0
got it mate Tomiwa Joseph 👍🏽