Python Forum
New to coding, and could use some help
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
New to coding, and could use some help
#1
So, I am very new to coding, a while back I bought a Python coding bundle off of Humble Bundle, and have just recently actually gotten to try and actually code, but I have hit a bit of a snag, I started off with the book 'Teach your kids to code', as I have no previous coding experience it seemed like a good place to start, I have followed the instructions put forth in the book, but I keep getting the same error message, I have tried mess around a bit with the code, with no luck, I have gone online, and tried to Google it, some things did pop up, but I couldn't get the connection between the other person's problem, and my own, so now I am asking here, and I hope that someone can help me. I will post pictures showing what the book puts forth, what I have typed in, and what message I get.

Thanks in advance

Jonas P.

[Image: view?usp=sharing]

[Image: view?usp=sharing]

[Image: view?usp=sharing]
Reply
#2
Please post your actual code in code tags (use the python icon when posting). Pictures of code don't help us much as we then have to type the whole thing out ourselves.
Reply
#3
(Jan-30-2018, 05:48 PM)Mekire Wrote: Please post your actual code in code tags (use the python icon when posting). Pictures of code don't help us much as we then have to type the whole thing out ourselves.

Sorry.

import turtle
t = turtle.pen()
turtle.bgcolor('black')
colors = ['yellow', 'green', 'blue', 'red']
for x in range(100):
    t.pencolor(colors[x%4])
    t.forward(x)
    t.left(91)
Hopefully this helps. As I said, I am new to coding, and even more so to this forum.

Sorry again.

Sincerely

Jonas P.
Reply
#4
check line #2. In the example it's t=turtle.Pen(), note the capital P
Reply
#5
(Jan-30-2018, 06:49 PM)buran Wrote: check line #2. In the example it's t=turtle.Pen(), note the capital P

Thank you! This problem have been bugging me quite a bit, I feel really silly for not noticing that I only needed to change the p. Thank you very much, again.

Hope that you have a great day.

Sincerely

Jonas P.
Reply
#6
Which IDE are you using. Code completion would help. I use PyCharm, a very professional and complete interactive development environment.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020