Please have the user enter the numbers in the list. Write a function to check that the two vectors (lists) are the same size as well as doing what the problem says.
Write a program that displays the first and last words of a sentence input by the user. Assume that the only punctuations is a period at the end of the sentences.
Is a pair a generalization of a tuple, or is a tuple a generalization of a pair?
Is a pair a kind of tuple, or is a tuple a kind of pair?
Write a function scalar_mult(s, v) that takes a number, s, and a list, v and returns the scalar multiple of v by s. :
test(scalar_mult(5, [1, 2]), [5, 10])
test(scalar_mult(3, [1, 0, -1]), [3, 0, -3])
test(scalar_mult(7, [3, 0, 5, 11, 2]), [21, 0, 35, 77, 14])
Write a function dot_product(u, v) that takes two lists of numbers of the same length, and returns the sum of the products of the corresponding elements of each (the dot_product).
test(dot_product([1, 1], [1, 1]), 2)
test(dot_product([1, 2], [1, 4]), 9)
test(dot_product([1, 2, 1], [1, 4, 3]), 12)