Ad

Optimized it a bit

Code
Diff
  • function sum(a,b) {
      let n = 0;
      while (n < 1000000000)
        {
          n++;
        }
      return a + b;
    }
    • function sum(a,b) {
    • return a+b; // wrong returning
    • let n = 0;
    • while (n < 1000000000)
    • {
    • n++;
    • }
    • return a + b;
    • }
Code
Diff
  • def multiply(a,b):
        return a * b
    multiply (5,10)
    print(multiply(5,10))
    
    • def multiply(a,b):
    • result = a*b
    • return result
    • return a * b
    • multiply (5,10)
    • print(multiply(5,10))