counter not inceasing in python
<p>I have looked at other while loops and am stuck on why this one is not working.</p>

<pre><code>points = int(input('How many points: '))
while True:
    u_cnt, c_cnt = 0, 0
    if u_cnt &lt; points or c_cnt &lt; points:
        if u &lt; c:
            c_cnt += 1
        elif u &gt; c:
            u_cnt += 1
</code></pre>

<p>Is my problems having the <code>c_cnt += 1</code> inside of two if statements?</p>

<p>I have put it outside of the <code>while</code> loop, yet that doesn't increase count either. I have also put the <code>u_cnt = 0</code> and <code>c_cnt = 0</code> on separate lines.</p>

<p>It's not doing an infinite loop, as it should not do. It's just not incrementing.</p>

<p>Thank you</p>

<p>edit:</p>

<pre><code>import random

u_name = input('What is your name? ')
points = int(input('How many points: '))
u_cnt, c_cnt = 0, 0

while True:
    a = ['rock', 'paper', 'scissors']
    comp = random.choice(a)
    print('Pick from:', str(a).strip('[]'))
    user = input()
    u = a.index(user)
    c = a.index(comp)
    line_1 = '{} : {}\t{} : {}'.format(u_name, user, 'Computer', comp)
    line_2 = '{} : {}\t{} : {}\n'.format(u_name, u_cnt, 'Computer', c_cnt)

    if c_cnt &lt; points or u_cnt &lt; points:
        if u &gt; c or u == 0 and c == 2:
            u_cnt += 1
            print(line_1, '\t', u_name, 'wins')
            print(line_2)
        elif u &lt; c or u == 2 and c == 0:
            c_cnt += 1
            print(line_1, '\t', 'Computer wins')
            print(line_2)
        elif u == c:
            print(line_1, '\t', 'Tie')
            print(line_2)
    else:
        break
</code></pre>

<p>so when you run this the first time, you get an answer back like</p>

<pre><code>What is your name? chad
How many points: 3
Pick from: 'rock', 'paper', 'scissors'
rock
chad : rock Computer : scissors      chad wins
chad : 0    Computer : 0

Pick from: 'rock', 'paper', 'scissors'
</code></pre>

<p>how to get the count be 1, 0 on the first iteration through.  that might be a better question.</p>

<p>You are resetting the counters to 0 every time you run the loop again so it may increment but it will just get rest to zero. To fix this you can move your variable declarations outside of the loop:</p>

<pre><code>points = int(input('How many points: '))
u_cnt, c_cnt = 0, 0
while True:
  if u_cnt &lt; points or c_cnt &lt; points:
      if u &lt; c:
          c_cnt += 1
      elif u &gt; c:
          u_cnt += 1
</code></pre>

<p>You are also have no method to exit the loop. You need to add in a <strong>break</strong> to exit the loop. For example:</p>

<pre><code>while True:
  if some_condition:
    break 
</code></pre>

python while-loop