title: Error - ValueError: The number of weights does not match the population in python 3
body: <p>I wrote a code to make a simple tic tac toe in python but an error is continuously popping. I can't figure out the problem.. pls help<a href="https://i.stack.imgur.com/hy896.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hy896.png" alt="enter image description here" /></a></p>
  <p><a href="https://i.stack.imgur.com/1qnzN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1qnzN.png" alt="enter image description here" /></a>
  The code works fine in first case but I don't know why it isn't</p>
  <p>You may check the code on any editor -</p>
  <pre class="lang-py prettyprint-override"><code>    import random
      from random import choices
      board = [1, 2, 3, 4, 5, 6, 7, 8, 9]
      weights = [0.1, 0.05, 0.1, 0.05, 0.3, 0.05 , 0.1, 0.05, 0.1]
      _board = [1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9]
      
      def choose_random():
          return(choices(board,weights))
      
      def draw():
          print(_board[0], _board[1], _board[2])
          print(_board[3], _board[4], _board[5])
          print(_board[6], _board[7], _board[8])
      
      def user_chance():
          draw()
          choice = int(input('Choose any of the block: '))
          board.remove(choice)
          index = _board.index(choice)
          _board[index] = &quot;X&quot;
          comp_chance()    
      
      def comp_chance():
          if(len(board) == 0):
              print(&quot;It's a tie !&quot;)
          else:
              random = choose_random()
              board.remove(random)
              index = _board.index(random)
              _board[index] = 'O'
              user_chance()
          
      user_chance()
  </code></pre>