Ad
Bugs

Single line, arrow function

For some reason the tester is throwing a syntax error but if you test it in the console it runs just fine

Code
Diff
  • let divide = (num1, num2) => num2 === 0 ? console.log("Division failed: division by zero") : !(num1 === +num1 && num2 === +num2) ? console.log("Division failed: integers and floats accepted only") : num1/num2  
    • def div(num1, num2):
    • try:
    • return (num1/num2)
    • except ZeroDivisionError:
    • print("Division failed: division by zero")
    • except TypeError:
    • print("Division failed: integers and floats accepted only")
    • let divide = (num1, num2) => num2 === 0 ? console.log("Division failed: division by zero") : !(num1 === +num1 && num2 === +num2) ? console.log("Division failed: integers and floats accepted only") : num1/num2