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 trialjamie Macdiarmid
2,048 PointsAlways stuck? Plus...
Stuck on this. (not sure what to use?).
Think I'm going to start again. A few questions though. Where it says 'Important. You must add the code to the previous code etc' (above the code challenge) where do you add and store it. I've just ignored it and actually written down various code challenges on a file block. If you are suck, where do you get a reference from. Do you go back into workspaces and go through each file until you see the datatype you need e.g Index function.
Thanks
I appreciate anyones help
Jamie
def loopy(items):
# Code goes here
1 Answer
Tobias Helmrich
31,603 PointsHey Jamie,
first you have to loop through the items array with a for in loop. Then you have to check if the item's index 0 (item[0]) is 0. If it is zero you have to skip this item which you do with a continue statement. If not just print out the current item.
Like this:
def loopy(items):
# Code goes here
for item in items:
if item[0] == "a":
continue
print(item)
About your questions: When the challenge says that you have to add the code to the previous code this just means that you should extend your code with the code the current task needs. That means that the code you have to write in this task probably needs the previous code. I'm not sure if I understood the question correctly, if not please let me know and I try to help you! :)
If you're stuck I recommend just watching the last videos where the part you're having problems with is covered. The challenges are almost always based on the videos before them so just watch them again, try writing the code in your workspace and follow along and you should be able to solve it, good luck! :)
jamie Macdiarmid
2,048 Pointsjamie Macdiarmid
2,048 Pointsthanks Tobias. So its not like you've pasted the code challenges and stored them all somewhere? Do you actually take notes?
Tobias Helmrich
31,603 PointsTobias Helmrich
31,603 PointsNo problem! :) No, I don't store the code of all challenges. However I am taking notes during the videos. I think it depends on ones preference but I have always opened Evernote, for every course I make a new Notebook and for every video (except when there is nothing "new" in it) I'm creating one note. Then I'm taking notes during the video for future reference. I also note problems I'm encountering so I also have a reference for possible problems in the future. Another approach would be to first watch the videos and just try and concentrate to understand what's happening and then watch it a second time and take notes then.
Like I said, it's probably personal preference so maybe you'll have to find your one way to do it but I hope that helps you a bit! :)
jamie Macdiarmid
2,048 Pointsjamie Macdiarmid
2,048 PointsOh thanks again. Sometimes when your unsure you always assume that there's something (or some secret way) that everyone else is doing it. I've just have been taking notes by hand. Suppose it doesn't really matter though. As long as its sinking in!!
Cheers
Jamie