Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialarun bennur
73 PointsI want my_list to have 1 as the last item.
with respect to the above question what the function call
1 Answer
Kent Åsvang
18,823 PointsI'm not sure that I have understood the question correctly, it was a little bit diffuse. Anyhow, if I assume you wish to add something to a list and make it the last item, in that case you just have to .append() it. Like so :
my_list = ["something", "something else", "something other than else", "and so on"]
my_list.append(1)
print(my_list)
# Output :
["something", "something else", "something other than else", "and so on", 1]
So the correct function call is ".append()".
I hope this helped. Good luck.
arun bennur
73 Pointsarun bennur
73 PointsTnx for lending help. It worked