title: W by H grid tiles?
body: <p>Imagine that we have a  <code>w</code>  by  <code>h</code>  grid, where the tiles are numbered starting at  <code>1</code>  in the top left corner.  <code>w</code>  (for width) and  <code>h</code>  (for height) have been stored in a function. You have access to these stored values, as long as you call them  <code>w</code> and  <code>h</code>. Write a program to return: The column number of a tile number given by the user. Start counting columns at column 1.</p>
  
  <pre><code>import subprocess
      def template(w, h, t):
  
          #w and h are memory locations that already contain values
          tile = t
  
          sum = ((t - 1) // w) + 1 
  #END OF YOUR CODE
  
  failed = 0
  width = 1
  while width &lt;= 3:
      height = 1
      while height &lt;= 3:
          tile = 1
          while tile  &lt;=  width * height:
              result  =  template(width, height, tile)
              col = (tile - 1) % width + 1
              if (result == col):
                  print "On a " + str(width) + " by " + str(height) +" board, with tile " + str(tile) +", col is " + str(col) + ", you got it RIGHT!"
              else:
                  print "On a " + str(width) + " by " +:str(height)%+" board, with tile " + str(tile)%+", col is " + str(col) + ", you got: " + str(result)
                  failed = 1
              tile += 1
          height += 1
      width += 1
  
  
  
  if (failed == 0):
      print "Your code is CORRECT!"
  
      print "Please check your code, at least one test case did not pass."
  </code></pre>
  
  <p>I am almost there I think, but this formula isn't quite right and I'm out of ideas. </p>