+ 2
[Solved] How to get to throw exception just once in this Python code and choose different messages for the same exception?
Do I need to get the input and the try blocks out of the for loop? What I want is for the interpreter to throw an exception defined by me the moment wrong input is entered: to remove the chance to enter both inputs wrong and recieve the same error message twice in one go. I also wish to define nearly as many exception messages as the conditions that can be seen in the exception(raise part) block. (conditionals also under "except" block part, with their specific messages?) I don't want the solution itself, if that’s OK, just a bit of guidance. And ofc, thank you. https://code.sololearn.com/c0BokyvDuicZ/?ref=app
1 Odpowiedź
+ 1
Jay Matthews Oh. lol. That's where I'd stopped in my course. Hadn't occurred to me but makes perfect sense, thank you!