Complete the code to calculate the square root of 16 using a built-in math function.
$result: math.[1](16);
The math.sqrt() function returns the square root of a number. Here, it calculates the square root of 16, which is 4.
Complete the code to round the number 4.7 down to the nearest whole number.
$rounded: math.[1](4.7);
The math.floor() function rounds a number down to the nearest whole number. So 4.7 becomes 4.
Fix the error in the code to get the absolute value of -10.
$absValue: math.[1](-10);
The math.abs() function returns the absolute value of a number, turning negative numbers positive.
Fill both blanks to calculate 2 raised to the power of 3.
$power: math.[1](2, [2]);
The math.pow(base, exponent) function raises the base to the power of the exponent. Here, 23 equals 8.
Fill all three blanks to create a map of words to their lengths, but only include words longer than 3 characters.
$lengths: ([1]: [2] for [3] in $words if str-length([3]) > 3);
This code creates a map where each word is a key, and its length (found by str-length(word)) is the value. The loop variable is also word. Only words longer than 3 characters are included.