Challenge: Secure Exception Handling
Aufgabe
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.
Lösung
War alles klar?
Danke für Ihr Feedback!
Abschnitt 1. Kapitel 6
single
Fragen Sie AI
Fragen Sie AI
Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen
Awesome!
Completion rate improved to 5.56
Challenge: Secure Exception Handling
Swipe um das Menü anzuzeigen
Aufgabe
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.
Lösung
War alles klar?
Danke für Ihr Feedback!
Abschnitt 1. Kapitel 6
single