title: Producing a list of squares from 1 to n
body: <p>Write a function called squares that takes in a parameter named n. If n is a positive integer, the function returns a list consisting of the squares of the numbers from 1 through n. Otherwise (i.e., if n is not a positive integer) the function should return an empty list. </p>
  
  <p>This function to work correctly even if the function is called with nonsensical arguments. In other words, function calls such as squares('Iowa'), squares(range(10)), and squares([1, 2, 3]) should return an empty list.</p>
  
  <p>def sqrt(x):
      ans = 0
      if x >= 0:
          while ans*ans &lt; x:
              ans+=1
          if ans *ans == x:return ans;</p>
  
  <pre><code>return -1;
  </code></pre>
  
  <p>def square(n):
      i=0
      blist= []
      ans = list(range(1, n ))</p>
  
  <pre><code>if (n &lt; 0):
      return blist
  if isinstance(ans, str):
      return blist
  while( i  &lt; len(ans)):
      if(sqrt(ans[i])!= -1):
          blist.append(ans[i])
      i = i+1
  return blist
  </code></pre>
  
  <p>i = square('boy')
  print(i)</p>