2 Replies - 288 Views - Last Post: 18 April 2013 - 12:30 PM Rate Topic: -----

#1 javathehut.  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 11-April 13

showing improper syntax when defining wn variable

Posted 18 April 2013 - 12:14 PM

I'm currently writing a simple python program that draws and fills a star using turtle, with 'n' number of points by th user. For some reason when I run the very beginning of my code, I get a syntax error when defining my wn variable. does anyone know why this may be?


import turtle

n = int(input('Enter an odd integer greater than or equal to 3: ')

wn = turtle.Screen()
wn.title(str(n) + "pointed star")

mac = turtle.Turtle()
mac.color("blue", "green") #pen color, fill color
mac.pensize(2) 



Is This A Good Question/Topic? 0
  • +

Replies To: showing improper syntax when defining wn variable

#2 sepp2k  Icon User is online

  • D.I.C Lover
  • member icon

Reputation: 2074
  • View blog
  • Posts: 3,154
  • Joined: 21-June 11

Re: showing improper syntax when defining wn variable

Posted 18 April 2013 - 12:19 PM

On line 3 you have more opening parentheses than closing parentheses. So it thinks line 5 is a continuation of line 3 and chokes because int(input(...)wn = turtle.Screen() is invalid syntax.
Was This Post Helpful? 0
  • +
  • -

#3 javathehut.  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 11-April 13

Re: showing improper syntax when defining wn variable

Posted 18 April 2013 - 12:30 PM

oh my gosh! thank you. what a silly error on my part. We are our own worst editors, after all. Thanks!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1