Code Challenges
- FizzBuzz
- Mean of a List
- Median of a List
- Variance of a List
- Standard Deviation of a List
- Sample Covariance
- Correlation Coefficient
- Simple Linear Regression
- Vector Dot Product
- Random Matrix
- Save
- Run All Cells
- Clear All Output
- Runtime
- Download
- Difficulty Rating
Loading Runtime
Write a function called dot_product
that takes in two lists of numbers and returns the dot product of the two lists as if they were linear algebra vectors.
If the vectors (lists) do not have the same dimensionality (length) then have the function return the string 'Dimension Mismatch'
. Typically, we would throw an error if the two vectors do not have the same dimensionality, but in this exercise, we'll just return a string to make it easier to grade your code.
Example 1:
dot_product([3,2,7], [8,5,9])
Returns: 97
Example 2:
dot_product([3,2,7], [8,5,9,4,5,2])
Returns: Dimension Mismatch
Reset Code