Exceptions, finally and raising exceptions | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 1

Exceptions, finally and raising exceptions

Please help me with how to use the exceptions,finally and raising exceptions in python I don’t get it at all Thank you!!

25th Jul 2022, 8:21 AM
Gift Claire
Gift Claire - avatar
2 Réponses
+ 4
Gift Claire The best way to help you is to show you. A little code which I hope will help. Note* Without exception handling, an incorrect choice would cause this program to crash, but now the exception creates an output. Try to input a valid colour. if you get it right, then you will get a valid output. Except, sometimes the input is incorrect, which would cause the program to crash, but now we can handle this exception and generate a message stating what the problem is. Finally you get a message telling you some helpful information https://code.sololearn.com/cw74VHr4a453/?ref=app
25th Jul 2022, 9:21 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 3
Hi, Gift Claire ! You can take a look at this code: https://code.sololearn.com/c0WIb10er3rR/?ref=app
25th Jul 2022, 9:08 AM
Per Bratthammar
Per Bratthammar - avatar