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

bookChallenge: Secure Exception Handling

Tehtävä

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.

Ratkaisu

Oliko kaikki selvää?

Miten voimme parantaa sitä?

Kiitos palautteestasi!

Osio 1. Luku 6
single

single

Kysy tekoälyä

expand

Kysy tekoälyä

ChatGPT

Kysy mitä tahansa tai kokeile jotakin ehdotetuista kysymyksistä aloittaaksesi keskustelumme

close

Awesome!

Completion rate improved to 5.56

bookChallenge: Secure Exception Handling

Pyyhkäise näyttääksesi valikon

Tehtävä

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.

Ratkaisu

Switch to desktopVaihda työpöytään todellista harjoitusta vartenJatka siitä, missä olet käyttämällä jotakin alla olevista vaihtoehdoista
Oliko kaikki selvää?

Miten voimme parantaa sitä?

Kiitos palautteestasi!

Osio 1. Luku 6
single

single

some-alt