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 trialks13
3,383 PointsHow do I append a value to a list?
I thought I was supposed to make a list value from 0-10 but I had to append values. What does that mean?
my_list = ['I', 'say', 'Python', 'is', 'a', 'really', 'nice', 'computer', 'programming', 'course', 'man']
for i in range (0, 10, 1):
my_list.append()
1 Answer
Asher Orr
Python Development Techdegree Graduate 9,409 PointsHi ks13!
"I thought I was supposed to make a list value from 0-10 but I had to append values. What does that mean?"
You don't need to make values and enter them into my_list.
The challenge asks for a for loop that iterates over a range with a stop value of 10, and a start value of 0. Then it wants you to append each value in the loop to my_list (using the syntax my_list.append(val)).
Your for loop looks good. You only need to remove the values you put in my_list & adjust some syntax: Like this:
my_list = []
#we want my_list to be empty, because the lines below will add/append values to it
for val in range (0, 10, 1):
#the line above is going to loop through each value in the range from 0-9
my_list.append()
#when you append to a list, you need to put *what* you're appending in the parentheses.
Let me know if you have further questions. I hope this helped!