title: Adding if/else statements to shape algorithm for beginner
body: <p>I'm trying to add if/else statements to a set of code that outputs a shape when the user specifies the shape with an input string and having difficulties. How would I add a simple If/else statement to my shapes code so that it only outputs a shape with the correct input string and when an incorrect input string is used it outputs an error message stating "Shape is not defined". </p>
  
  <p>One of my shape codes is a simple square algorithm:</p>
  
  <pre><code>def square(size, chr):
      row = 1
      while row &lt;= size:
          col = 1
          while col &lt;= size:
              print chr, 
              col = col + 1
          print '' 
          row = row + 1
      print ''
  </code></pre>
  
  <p>Updated code:</p>
  
  <pre><code>print('Please specify a shape to draw. Type S for square, T for triangle, R for reverse triangle, D for diagonal, and A for angle')
  shape = raw_input('Please specify a shape to draw:')
  size = input('Please enter a size:')
  chr = raw_input('Please enter a drawing character:')
  print''
  
  valid_shape_codes =('"S":square, "T":triangle, "R":reversetriangle, "D":diagonal, "A":angle')
  if shape in valid_shape_codes:
      valid_shape_codes[shape](size, chr)
  else:
       print 'Shape is not defined'
  </code></pre>