Slice indices must be integers or None or have an index method

This is the exercise link:;

I am getting this error, how can i solve this?

It appears you called your function using string values when it calls for integers.

If you want to find a particular item in a list you have to call its index which is an integer:

letters = ['a', 'b', 'c', 'd', 'e']

a = letters[0] 
#a is equal to the first item in the letters list, or 0
#which is 'a'

d = letters[3] 
#d is equal to the fourth item in the list or 3

1 Like
variable = letters[0: 3] 

This will be equal to every item in the letters list starting at 0 or the first item.
However it will not include 3, it will stop when it gets there.

You have a similar bug with find.

Pay special attention to the input and output of each thing you use, look up what they are rather than assuming it’s one thing or another.