Challenge: Secure Exception Handling
Tâche
Swipe to start coding
Write a function that securely handles exceptions when dividing two numbers. The function must only catch specific exceptions and must not reveal any internal error details in its return value.
- If division is successful, return the result.
- If a
ZeroDivisionErrororTypeErroroccurs, return the string "An error occurred. Please check your input.". - Do not return or expose any exception messages or stack traces.
Solution
Tout était clair ?
Merci pour vos commentaires !
Section 1. Chapitre 6
single
Demandez à l'IA
Demandez à l'IA
Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion
Awesome!
Completion rate improved to 5.56
Challenge: Secure Exception Handling
Glissez pour afficher le menu
Tâche
Swipe to start coding
Write a function that securely handles exceptions when dividing two numbers. The function must only catch specific exceptions and must not reveal any internal error details in its return value.
- If division is successful, return the result.
- If a
ZeroDivisionErrororTypeErroroccurs, return the string "An error occurred. Please check your input.". - Do not return or expose any exception messages or stack traces.
Solution
Tout était clair ?
Merci pour vos commentaires !
Section 1. Chapitre 6
single