# Lists ( how to print specific item )

**URL:** <https://discuss.python.org/t/lists-how-to-print-specific-item/62524>\
**Category:** Python Help\
**Created:** [September 1, 2024, 12:56am UTC](https://discuss.python.org/t/lists-how-to-print-specific-item/62524 "2024-09-01T00:56:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Life132](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/life132/32/21942_2.png) [@Life132](https://discuss.python.org/u/Life132)\
**Post date:** [September 1, 2024, 12:56am UTC](https://discuss.python.org/t/lists-how-to-print-specific-item/62524/1 "2024-09-01T00:56:57Z")

</div>

How do you print a specific item from a list??

```python
mylist = ["banana", "cherry", "apple"]

for i in mylist :
    print(mylist[0])

```

When I run the above code it prints…

banana  
banana  
banana

And I don’t know how to fix it.

---

<div class="post-metadata">

**Author:** ![MRAB](https://avatars.discourse-cdn.com/v4/letter/m/e9c0ed/32.png) [@MRAB](https://discuss.python.org/u/MRAB)\
**Post date:** [September 1, 2024, 1:06am UTC](https://discuss.python.org/t/lists-how-to-print-specific-item/62524/2 "2024-09-01T01:06:21Z")

</div>

It’s iterating over the list, assigning `i` to each item, so:

```python
for i in mylist:
    print(i)

```

---

<div class="post-metadata">

**Author:** ![onePythonUser](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/onepythonuser/32/19158_2.png) [@onePythonUser](https://discuss.python.org/u/onePythonUser)\
**Post date:** [September 1, 2024, 4:00am UTC](https://discuss.python.org/t/lists-how-to-print-specific-item/62524/3 "2024-09-01T04:00:16Z")

</div>

Hi,

when working with lists, note that each item in the list corresponds to an index number, starting from `0` (i.e., its location in the list, starting from `0` and and increasing `1`, `2`, …, `n`). This is why when you iterated through the list, and you had the index fixed to `0`, it always printed `banana`. By iterating through the list, and not having the index value to a fixed value, allows you to iterate through all of the values in the list.

Here is an example where we make use of the `enumerate` keyword to iterate through the list values while simultaneously keeping tabs on the index value.

```python
mylist = ["banana", "cherry", "apple"]

for index, item in enumerate(mylist):
    print(f'mylist[{str(index)}] = {item}')

```

---

<div class="post-metadata">

**Author:** ![chepner](https://avatars.discourse-cdn.com/v4/letter/c/22d042/32.png) [@chepner](https://discuss.python.org/u/chepner)\
**Post date:** [September 1, 2024, 4:16pm UTC](https://discuss.python.org/t/lists-how-to-print-specific-item/62524/4 "2024-09-01T16:16:49Z")

</div>

I’m guessing that your mental model is that on each iteration of the loop, `mylist[0]` refers to the “next” item of the list.

There is an anonymous list iterator that tracks the “walk” through `mylist`; the name `mylist` itself is not that iterator: it always refers to the list itself. `i` gets its value (an element of the list) from the list iterator, not from the list directly.
