10/18 - This could not be more simple... so why doesn't it accept my solution?


#1

Never mind. I solved it.

Instructions:
image
This one seems as straightforward as they come: Update a variable, click Run and move on to the next problem. However, it is not accepting my code.

def list_function(x):
  x[1] = x[1] + 3
  return x[1]

n = [3, 5, 7]
print list_function(n)

OR…

def list_function(x):
  x[1] += 3
  return x[1]

n = [3, 5, 7]
print list_function(n)

How is it neither of these work? The console is printing 8 which ought to be the correct amount if I add 3 to the item at index 1 (which is 5).


#2

instructions:

return the list

what do you return?


#3

I misread the instruction that said “Return the list.” I was expecting to have to return the item at that specific index. Re-reading the instructions cleared this one up for me. Thanks for the reply!


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.