Lesson 15 Puzzle 5


#1

I’m having a difficult time adding 5 to each of the values in myArray like it asks. I tried putting myArray = myArray + 5 inside the If Statement, but, that’s not working. Any ideas?


#2

@brewerke

You need to be more specific when referring to an element in an array. Since myArray is a list of numbers, we need an indexto access one of the numbers.
myArray is the whole list. myArray [1], myArray [2], are each one number in that list.

The for loop uses the variable i to visit each element, one at a time. Therefore, your code needs the index. Try myArray [i] = myArray [i] + 5;

Andrea