Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Impara Challenge: Secure Exception Handling | Understanding Python Vulnerabilities
Python Security Best Practices

bookChallenge: Secure Exception Handling

Compito

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 ZeroDivisionError or TypeError occurs, return the string "An error occurred. Please check your input.".
  • Do not return or expose any exception messages or stack traces.

Soluzione

Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 1. Capitolo 6
single

single

Chieda ad AI

expand

Chieda ad AI

ChatGPT

Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione

Suggested prompts:

Can you explain this in more detail?

What are the main benefits of this approach?

Are there any common mistakes to avoid?

close

Awesome!

Completion rate improved to 5.56

bookChallenge: Secure Exception Handling

Scorri per mostrare il menu

Compito

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 ZeroDivisionError or TypeError occurs, return the string "An error occurred. Please check your input.".
  • Do not return or expose any exception messages or stack traces.

Soluzione

Switch to desktopCambia al desktop per esercitarti nel mondo realeContinua da dove ti trovi utilizzando una delle opzioni seguenti
Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 1. Capitolo 6
single

single

some-alt