15/15 help please


hi my code works but it returns the value in a list inside [ ] and keeps returning an error. how can i get rid of the [ ]


@atlantaspp: When you assign something in brackets, [] , to variable, it will turn into a list.

newVariable = [ listA[1] + listB[1]] # Will generate another list containing the value
#you get after adding the elements that are stored in the index 1 of each list.
newVariable = listA[1] + listB[1] #Won't generate a new list, will only have the value of the addition.

I think generateis a strong word for this but just know you'll get another list if you do like the first example.


No problem, Pierrepp! Glad to help!


i tired that but it still saying same thing again


@atlantaspp: That's because you're returning the list whenever the length of is one.
Return the actual value on it, since it's just one element,it should be lst[0]

But note:

If you are given a sequence with an even number of elements, you must average the two elements surrounding the middle.

Does your code works if the length of your list is an odd number?