Welcome to the Treehouse Community
Looking to learn something new?
Daniel Lodestro2,572 Points
letter_game.py My game is tracking each correct guess as a 'strike' and the game won't end when I've guessed correctly!
I watched and re-watched, and I cannot seem to find where I slipped up. Also not sure how to include the snapshot of my code so here is the link: https://w.trhou.se/2gqn526sjl
Hopefully that works. I'm currently staring at the block that contains the strike portion, but it all looks correct to my amateur eyes.
Thanks in advance for your help!
Side note: Before each video, he asks us to pause and write the code ourselves. Is it normal for me to not have much of an idea as to how to do this? I feel like maybe the way I'm learning on Treehouse isn't helping me, but hurting me. I almost feel like a spoonfed baby, which is great sometimes, but when asked to go write code myself, I can't comprehend it or even know how to begin. I can't remember parts of the syntax etc. I suppose the question would be, is this normal? I've never written code in my life, and currently I'm using Treehouse and Codecademy simultaneously.
Jamal Scott9,656 Points
Its normal. It took me awhile to understand your code and debug it but im still new to this as well and dont worry about the "writing code for yourself part" yet, with time you'll eventually grasp alot of the teachings and since you're new, then soaking up all that info and trying to remember will be difficult, so its better to continue with the course until its more comfortable for you. Remember you can always redo the course, if you get to the end and you're still not comfortable then I would redo the course and attempt to write the code myself then. :)
Main problem was from line 52 to 61. Nothing you couldn't fix. Happy coding https://w.trhou.se/nqqyzrcz2l
Chris FreemanTreehouse Moderator 67,989 Points
while conditional, try changing the
list to `set:
# old while len(bad_guesses) < 7 and len(good_guesses) != len(list(secret_word)): # new while len(bad_guesses) < 7 and len(good_guesses) != len(set(secret_word)):
This will handle the case where secret word has multiples of a letter.
Jason AndersTreehouse Moderator 145,624 Points
It's been awhile since I've done Python. I've included a snapshot from my archived Workspace for you to compare code.
As for what you are feeling, I think that is completely normal. I felt exactly that way with Python and with Ruby on Rails. However, I'm very comfortable with most of the other languages, especially iOS and PHP. So, I think it will come down to what you like and what you grasp naturally. Just because you struggle with one, does NOT mean you won't excel at the others.
I gave Python (and Ruby) a break and focused on the others that I find really click with me. Don't get me wrong, I'm not bad-mouthing any language or saying stay away, I'm saying stick with what you get... focus on that... and then when you want, you can go back. I do plan to go back to Ruby and Python... just not right now.
Keep Coding! :)