Appending to a list


Oops, try again. Did you remember to append the number 4 to the end of your list?

n = [1, 3, 5]
n = n.append(4)# Append the number 4 here

print n

is anybody could tell me what's wrong with my code please?


the append method will add the element to your list in memory. No need to assign that action to n. When you do that you override the value of n to None since the append operation does not return anything.


Got it!! Thanks!!!!!!!!!!!!!!!!!!!!!!


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