Question: I'm new at coding and I have a school project where we work with JavaScript and jQuery. I can't figure out how to associate a random image to an onclick event and have that image appear in a div. Basically it's a fake dating site and once you press submit it generates a random image from 3 images I have and appears in a div. Please help I'm lost here.

```
  function randomImg1() {
    var myImage1 = new Array();
    myImage1[0] = "Bush.jpg";
    myImage1[1] = "RiffRaff.jpg";
    myImage1[2] = "FredPellerin.jpg";
    var random = Math.floor(Math.random() * myImage1.length);
    document.getElementById("image").innerHTML = "<img src='" 
      + myImage1[random] + "' alt='image'></img>";
  }

```

Answer: 
You can just iterate through the list; you're confusing indices with elements. You one one of the following:

```
for i in my_list:
    print (i)

```

-- OR --

```
for i in range(len(my_list)):
    print (my_list[i])

```

To illustrate a more severe version of what you did, try this:

```
my_list = range(5, 15)
print my_list

for i in range(5, 15):
    print (i, my_list[i])

```

Output:

```
[5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
5 10
6 11
7 12
8 13
9 14
10
IndexError: list index out of range

```
You're iterating through every `i` in `my_list`. You want to be printing `i`:

```
my_list = range(1, 75)

for i in my_list:
    print i

```