So I have a list that has numbers like [1,2,3,4,5]
. What I need the code to be able to multiply and add the numbers so it would look like 1*5 + 2*4 + 3*3 + 4*2 + 5*1
. Although these numbers can change based on user input, so it can also look like [1,2,3,4]
(1*4+2*3+3*2+4*1
)
Also, I'm only allowed to use the operations of the length of list, list accessor, create an empty list, List append.