Basic Algebraic Math hacks

Q1 (Exponents):

A cube has a side length of 6 units. What is its volume?

%%javascript
// Calculate and log the volume of a cube with side length 6
let side = 6;
let volume = side ** 3;
console.log(`A cube with side length ${side} has volume ${volume}.`);
<IPython.core.display.Javascript object>

Q2 (PEMDAS):

Evaluate the expression:

(7+14)*5/12 + 2

%%javascript

let result = (7 + 14) * 5 / 12 + 2;
console.log(`The result of the expression is ${result}.`);
<IPython.core.display.Javascript object>

Q3 (Algorithm):

Write JavaScript code where you define variables and run commands that find the values of operations you apply onto them

%%javascript

let a = 3;
let b = 4;
let c = Math.sqrt(a ** 2 + b ** 2);
console.log(`The value of c in pythagorean theorem is ${c}.`);
<IPython.core.display.Javascript object>

Diagram showing mathematical operations