Challenge: Secure Exception Handling
Tarefa
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.
Solução
Tudo estava claro?
Obrigado pelo seu feedback!
Seção 1. Capítulo 6
single
Pergunte à IA
Pergunte à IA
Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo
Awesome!
Completion rate improved to 5.56
Challenge: Secure Exception Handling
Deslize para mostrar o menu
Tarefa
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.
Solução
Tudo estava claro?
Obrigado pelo seu feedback!
Seção 1. Capítulo 6
single