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 trialBrent Capuano
949 PointsHelp! Getting a "none" value in my list while trying to incorporate strings
Plase help. When I added strings into my list, it generated "none" items and the number of items is wrong now.
here is my code
other_list = [ ["6"], ["0"], ] my_list = [ [4], [1], [7], [print("HOY HOY HOY")], [print("JJ")], [print(other_list)], ]
other_list = [
["6"],
["0"],
]
my_list = [
[4],
[1],
[7],
[print("HOY HOY HOY")],
[print("JJ")],
[print(other_list)],
]
1 Answer
nia
9,150 PointsHello, Brent!
Dave's completely right, the print statements are not valid because they aren't actually elements. Think of the things in a list as a shopping basket. You can only put in actual things like strings and numbers, not actions like print.
As for the rest of the challenge, the first 3 items should just be numbers like 3, 4, 5, not in brackets. The next 2 items in the list should be strings, i.e. anything encased in just quotation marks, like "Hello world" or "8." The last item should be a list containing 2 items. So this should be two items that are numbers or strings, encased in a single pair of brackets. To summarize:
-the first 3 items should be simply numbers, no brackets or quotation marks -the next 2 items should be strings, i.e. anything encased in quotation marks -the next item should be a list containing 2 items, like [2019, "new year!"] -all of this should be contained in a single pair of brackets, assigned to the list my_list
I hope this helps!
Dave StSomeWhere
19,870 PointsDave StSomeWhere
19,870 PointsAre not valid list elements, so you get [None].