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: 
`range(1, 75)` represents the numbers `1..74`. It has indices `0..73`.

`my_list[74]` will IndexError since the largest index is `73`.

---

As other answers have mentioned, it seems you've mistaken indices for values. `for foo in bar` in Python gives you all the VALUES in `bar`, not the indices.

`enumerate` is a common tool to get both index and value from an iterable. It's a bit silly on a `range` object, but you could do it:

```
my_list = range(1, 75)

for i, val in enumerate(my_list):
    print(my_list[i])  # my_list[i] == val

```

`enumerate(bar)` is essentially just `zip(range(len(bar)), bar)`.
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

```