Welcome to the Treehouse Community
Looking to learn something new?
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 ?