Challenge: Secure Exception Handling
Завдання
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.
Рішення
Все було зрозуміло?
Дякуємо за ваш відгук!
Секція 1. Розділ 6
single
Запитати АІ
Запитати АІ
Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат
Suggested prompts:
Can you explain this in more detail?
What are the main benefits of this approach?
Are there any common mistakes to avoid?
Awesome!
Completion rate improved to 5.56
Challenge: Secure Exception Handling
Свайпніть щоб показати меню
Завдання
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.
Рішення
Все було зрозуміло?
Дякуємо за ваш відгук!
Секція 1. Розділ 6
single