title: i've been trying to get this code to work for hours and I've tried to fix it in multiple ways and it still doesn't work
body: <p>i've been trying to get this to work for hours and I've tried to fix it in multiple ways and it still doesn't work.</p>
  <pre><code># this creates my class &quot;bucket&quot;
  class bucket:
      def __init__(self, water, capcity):
          self.water = water
          self.capcity = capcity
  
  
  # here I create my objects
  bucket1 = bucket(0, 3)
  bucket2 = bucket(0, 5)
  
  
  # this is the printing code to print how much water there is in every bucket
  def pr_v():
      print(&quot;Bucket_ONE &quot; + str(bucket1.water) + &quot;L&quot;)
      print(&quot;Bucket_TWO &quot; + str(bucket2.water) + &quot;L&quot;)
      print(&quot; &quot;)
  
  
  # this is where my problem is
  # this scirpt is supposed to trasfer water from the pouring bucket (p_bucket) to the receiving bucket untill the receiving bucket reaches it's
  # capacity or the pouring bucket runs out of water
  def pour_water(p_bucket, g_bucket):
      while g_bucket.capcity &gt;= g_bucket.water or p_bucket.water != -1:
          if g_bucket.capcity != g_bucket.water or p_bucket.water != -1:
  
              if g_bucket.capcity &lt; g_bucket.water:
                  bucket.water = g_bucket.capcity
                  break
              p_bucket.water -= 1
              g_bucket.water += 1
              pr_v()
  
      if p_bucket.water == -1:
          p_bucket.water = 0
  
  
  # this fills the bucket to it's capacity 
  def fill_water(self):
      self.water = self.capcity
  
  
  fill_water(bucket2)
  pour_water(bucket2, bucket1)
  pr_v()
  </code></pre>
  <p>when I execute the code this happens</p>
  <pre><code>Bucket_ONE 1L
  Bucket_TWO 4L
   
  Bucket_ONE 2L
  Bucket_TWO 3L
  </code></pre>
  <p>it's supposed to stop here because bucket 1 reaches its capacity</p>
  <p>↓</p>
  <pre><code>Bucket_ONE 3L
  Bucket_TWO 2L
   
  Bucket_ONE 4L
  Bucket_TWO 1L
   
  Bucket_ONE 4L
  Bucket_TWO 1L
  </code></pre>
  <p>why does this happen?
  Im new to coding so I might not know a lot of stuff</p>
  <p>Thanks</p>