A programmer writes the following Python program to calculate the square of a number:
def calculate_square(num):
squared_val = num * num
return squared_val
calculate_square(4)
print(squared_val)
The programmer notices that the last line of this program does not work as expected and causes an error.
State why the line print(squared_val) does not work as expected.