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!
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 trial
Difficulty with Challenges
Hello, I was just wondering if others are having trouble starting challenges. There have been a few challenges now that I can't even think about how to go about solving it. Once I start looking up information on what it is asking me to do I finally start to get an idea about how to start writing my code. Does anyone else find themselves in this situation? When I get an answer or get close to it I make sure that it makes sense to me but sometimes I wonder if I just think it makes sense when in reality it doesn't? I don't have any kind of background in programming so I was just wondering how others feel. If I am having trouble starting off challenges should I start over from the basics to make sure that I am actually learning?
My way to solve problems is to think: "How would I do this manually in real life?"
For example, if your challenge is to reverse a string, I think to myself, "How would I do this step-by-step on my own?" There are several ways to do this manually, but my preferred way is to imagine two strings: the one you are reversing and the one you want to be the result (aka the new reversed string).
On the first "step", you take the first letter of the first string, and append it to the end of the second string. Then you take the second letter and repeat, then the third, etc. The You repeat the process until the second string is done, then you return it.
It should be apparent that a loop is needed. (Notice the word "step")
def reverse(string): new_string = '' for i in range(len(string)): new_string += string[i] return new_string
This way of solving problems usually works for most basic problems.
Eventually, when you do a lot of these kind of problems, it starts to get easier because you've seen many kinds of problems. It is expected to be difficult at first, though. You are doing excellent! Keep on learning and good luck
Jt Miller1,242 Points
I find that the beginning is more difficult because you are building a programmers mindset, knowing syntax and knowing how to use it is different.
Podrig Leoghain5,094 Points
I second what Justice Miller said. Don't worry, I'm feeling the same way but taking the advice of others whixh is... Keep pushing on and trying your best. Pray for the strength to endure a hard life ?