title: SyntaxError: name 'cows' is assigned to before global declaration in Python3.6
body: <p>I am trying to edit the global variables <code>cows</code> and <code>bulls</code> inside a loop but getting this error <code>"SyntaxError: name 'cows' is assigned to before global declaration"</code></p>
  
  <pre><code>import random
  
  random_no = random.sample(range(0, 10), 4)
  cows = 0
  bulls = 0
  #random_num = ','.join(map(str, random_no))
  print(random_no)
  user_input = input("Guess the no: ")
  for index, num in enumerate(random_no):
      global cows, bulls
      print(index, num)
      if user_input[index] == num:
          cows += 1
      elif user_input[index] in random_no:
          bulls += 1
  
  print(f'{cows} cows and {bulls} bulls')
  </code></pre>