Skip to content

Commit cd62ee0

Browse files
authored
Merge pull request #65 from pmarrai/patch-1
Update 12-for-loops.md
2 parents fbe4418 + 214d3c4 commit cd62ee0

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

episodes/12-for-loops.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,4 +360,16 @@ print(total)
360360
> print('My favorite season is ', seasons[4])
361361
> ~~~
362362
> {: .python}
363+
>
364+
> > ## Solution
365+
> >
366+
> > It is an index error:
367+
> > ~~~
368+
> > IndexError: list index out of range
369+
> > ~~~
370+
> > {: .error}
371+
> >
372+
> > The problem is that `4` points to an item that doesn't exist in the list. Remember the first item of a list in Python is `0`.
373+
> > Replace `seasons[4]` with `seasons[0]`, `seasons[1]`, `seasons[2]` or `seasons[3]` to have the different items of the list printed.
374+
> {: .solution}
363375
{: .challenge}

0 commit comments

Comments
 (0)