Create a Python function that computes and returns the average of numerical elements in a list.
The task requires the calculation of the mean or average of a list of numbers. Average represents the central tendency of a data set and it is calculated by adding up all data points and then dividing the total by the number of data points. The task includes writing a function that takes in a list of numbers and returns their average. ### Parameters - `nums` (list): This is a list of numbers and it can contain both integer and floating-point values. ### Return Value - The function would return a `float` value that represents the average of the values in `nums`. ### Examples ```python # The average here is (2 + 5 + 8 + 12) / 4 = 6.75 average([2,5,8,12]) # Expected output: 6.75 # The average here is (3 + 6 + 9 + 15) / 4 = 8.25 average([3,6,9,15]) # Expected output: 8.25 # The average here is (32 + 16) / 2 = 24.0 average([32,16]) # Expected output: 24.0 ```