title: TypeError with exec()
body: <p>I'm trying to make a program that draws certain lines based on user input.</p>
  
  <pre><code>#import turtle program
  #called it cassy cause I was trying to come up with a fun name for an arrow 
  that they call 'classic'. I tried ok.
  import turtle
  cassy = turtle.Turtle()
  cassy.shape('classic')
  
  #set's the window shape, so I can give myself more room
  #for reference, putting startx and y as none centers it
  turtle.setup(width=1200, height=600, startx=None, starty=None)
  
  
  
  #used to find the height of what the screen size is so I could figure out 
  what it was set at.
  """print(turtle.window_width())
  print(turtle.window_height())"""
  
  
  #gives our wonderful circle a home (where it starts), to the right and 
  middle of the box
  #old code (turtle.setworldcoordinates(-20, -20, 0, 20))
  cassy.hideturtle()
  cassy.penup()
  cassy.goto(580, 0)
  
  #sets the turtle to be facing left
  cassy.left(180)
  cassy.showturtle()
  cassy.pendown()
  
  #as always, I gotta have that sweet sweet starting message.
  print("Welcome to the line generator!")
  print("To start, type in a letter")
  
  
  #using a dictionary function so I can assign each character a "Line"
  line = {
      "a" : "cassy.left(20)",
      "b" : "cassy.forward(20)",
      "c" : "cassy.right(45)",
      "d" : "cassy.right(70)",    
      "e" : "cassy.circle(10)",
      "f" : "cassy.left(15)",
      "g" : "cassy.forward(15)",
      "h" : "cassy.left(60)",
      "i" : "cassy.forward(10)",
      "j" : "cassy.forward(55)",
      "k" : "cassy.circle(50, 100)",
      "l" : "cassy.right(80)",
      "m" : "cassy.forward(35)",
      "n" : "cassy.left(75)",
      "o" : "cassy.forward(45)",
      "p" : "cassy.right(5)",
      "q" : "cassy.forward(100)",
      "r" : "cassy.right(65)",
      "s" : "cassy.forward(125)",
      "t" : "cassy.left(25)",
      "u" : "cassy.forward(150)",
      "v" : "cassy.right(95)",
      "w" : "cassy.forward(120)",
      "x" : "cassy.circle(25, 175)",
      "y" : "cassy.circle(5, 190)",
      "z" : "cassy.forward(175)",
      "0" : "cassy.right(20)",
      "1" : "cassy.forward(210)",
      "2" : "cassy.left(120)",
      "3" : "cassy.forward(115)",
      "4" : "cassy.forward(15)",
      "5" : "cassy.circle(30, 150)",
      "6" : "cassy.left(70)",
      "7" : "cassy.right(40)",
      "8" : "cassy.backward(30)",
      "9" : "cassy.backward(130)"
  }
  
  #let's the user type in letters/numbers (and only those (unless I want to         
  mix things up; we'll see))
  while True:
      draw = input("Type anything to draw! ")
  
      #if statement to make sure that they only type in numbers or letters
      if(draw.isalnum() == True):
  
          #I can only assume that this executes the code inside the quotes
          #but I haven't looked too deeply into what exec() does
          exec(line.get(draw))
  
          #this seperates each character drawn by a space, for funsies (yes I know it's a weird thing to say)
          cassy.penup()
          cassy.forward(15)
          cassy.pendown()
  
      #else statement in case they type in other charaters that aren't numbers or letters
      else:
          print("Please only use letters or numbers.")
  </code></pre>
  
  <p>Ok so I know it's a lot to read, but my real problem is this line of code</p>
  
  <pre><code>exec(line.get(draw))
  </code></pre>
  
  <p>So far the program only works when I type in 1 letter at a time. but if I try and type in more than one letter, such as the phrase "hello" it gives me this error</p>
  
  <pre><code>Traceback (most recent call last):
    File "C:/Users/73059/Final Project/Final Project funstuffs.py", line 87, in &lt;module&gt;
      exec(line.get(draw))
  TypeError: exec() arg 1 must be a string, bytes or code object
  </code></pre>
  
  <p>I don't really know a lot about the function exec(), and I've been trying to look stuff up about it, this is a project and I don't really have a lot of time.</p>
  
  <p>If there's any problems with it, or you don't understand what I'm trying to accomplish, please let me know. I'm sort of desperate.</p>
  
  <p>Thanks</p>