title: Quick Inquiry About My Program
body: <p>I'm currently doing a programming concepts course for python and this is one of my assignments. I basically had to multiply through adding. I had it to the point where I have everything that needs to be done done but this right here is extra credit. I already submitted the assignment but now I'm here to just ask why this wasn't working. </p>
  
  <p>The problem is that it wasn't working when the <code>yMult</code> variable was a float number. What I think was happening is that my counter (as the teacher wanted us to do it with a loop and a counter) is going up by 1 each time and if I have a floating point number as the <code>yMult</code> that it wouldn't have the <code>xMult</code> go up by like say .5. What would I do to fix this and/or what would it look like? </p>
  
  <p>Here is the code I had made:</p>
  
  <pre><code>def add(xAdd, yAdd):    
       return xAdd + yAdd
  
  def subtract(xSub, ySub):    
       return xSub + (-ySub)
  
  def multiply(xMult, yMult):    
       total = 0.0    
       counter = 0.0    
       while counter &gt; yMult:      
           if yMult &lt;= 0.0:
               total = add(total, -xMult)
               counter = add(counter, -1.0)
       while counter &lt; yMult:
           if yMult &gt;= 0.0:
               total = add(total,xMult)
               counter = add(counter, 1.0)
       return total
  
  def main():
      print multiply (5.5,9), multiply(9,5.5), multiply(2,4), multiply(2,-4), multiply(-4,2), multiply(-4,-2), multiply(4,1), multiply(1, 4), multiply(4, 0), multiply(0, 4), multiply(4, -1)
  
  main()
  </code></pre>
  
  <p>The results were as follows: <code>49.5 54.0 8.0 -8.0 -8.0 8.0 4.0 4.0 0.0 0.0 -4.0</code></p>
  
  <p>Any help would be awesome!</p>