September 16th, 2013, 03:02 PM
Am I learning Python fast enough?
I'm working through Programming for the Absolute Beginner and I've been at it for a couple of weeks. I've just run into my first real headache. This is basically lifted from the Hangman program. And this loop had me banging my head on the table for an hour before I dissected it by making it print out variables after each loop. Now I get it.
This seemed to stump me so much and it took me awhile to understand it. I just couldn't focus enough and see it. I'm wondering if I should be getting this stuff faster if I have any hope of doing this professionally. I like this but it's quite challenging. Are my doubts well founded or is this normal to take a little while to wrap ones head around something, as seemingly as simple as this? Thanks.
word = "turbo"
so_far = "_____"
new = ""
guess = input("Enter letter guess: ")
for i in range(len(word)):
if guess == word[i]:
new += guess
new += so_far[i]
so_far = new
September 16th, 2013, 03:58 PM
Well considering you're an absolute beginner, I don't think there's anything wrong with this.
If you've never programmed before, you're not supposed to understand the basics from the get-go. And when you do learn the basics, while you might not have trouble understanding loops, you will still have problems to solve, some of them easy, some of them quite complicated. I suggest not giving up, because, in my opinion, intellectually challenging yourself is pretty much the best thing about being a programmer.
Have fun, and good luck
P.S. you messed up the indentation in your code here.
September 17th, 2013, 07:16 AM
Yes, sorry for the bad indention
September 17th, 2013, 12:50 PM
I have to agree that a few temporary test prints will help you understand Python code better.
On your indentations use the standard 4 spaces. Do not use tabs, since editors are set to different tab sizes. Never mix tabs and spaces!
Last edited by Dietrich; September 17th, 2013 at 12:58 PM.
Real Programmers always confuse Christmas and Halloween because Oct31 == Dec25