FAQ: Code Challenge: Lists - Append Size

This community-built FAQ covers the “Append Size” exercise from the lesson “Code Challenge: Lists”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Computer Science
Data Science

FAQs on the exercise Append Size

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

14 posts were split to a new topic: Why does my code return None?

Dont know if im at the right place, but:

I am on “Python code challenges: Lists”
Append Size

First I didnt find the solution to task 1, ended up clicking “View solution”.
Then I tried to “copy” the answer, and just write it myself. Did so, syntax error.
Clicked on “View solution”, ctrl+c, restarted task, ctrl+v; It works
Write on my own again, above each line so I can see the exact line of code while writing. Syntax error.

How is this possible??

This is the solution

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#Write your function here

def append_size(1st):
1st.append(len(1st))
return 1st

#Uncomment the line below when your function is done

print(append_size([23, 42, 108]))
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Again. When I write the code exactly like the solution, I get syntax error:

def append_size(1st):
                              ^

SyntaxError: invalid syntax
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Makes me question if this is for me :tired_face:

Some fonts should just not be used when coding, particularly those which don’t easily distinguish characters like this. The problem is that variable should’ve been the lower case of LST, not 1ST. So “lst” not “1st” like “list” with the letter I removed. In Python you can’t start variable names with a number so a syntax error is thrown when you try.

1 Like