how do I multiply lists together in python using a function? This is what I have:
list = [1, 2, 3, 4]
def list_multiplication(list, value):
mylist = []
for item in list:
for place in value:
mylist.append(item*value)
return mylist
So I want to use this to multiply list*list (1*1, 2*2, 3*3, 4*4)
So the output would be 1, 4, 9, and 16. How would I do this in python where the 2nd list could be anything? Thanks