title: How do i make my code better python (tic tac toe)
body: <p>I've tried to make a tic tac toe game in Python. From what I make I feel that my code is working however it is really bad. Is there anyway to improve from this code?</p>
  <pre><code>class Board():
      def __init__(self): 
          self.board = [&quot;[]&quot;,&quot;[]&quot;,&quot;[]&quot;,&quot;[]&quot;,&quot;[]&quot;,&quot;[]&quot;,&quot;[]&quot;,&quot;[]&quot;,&quot;[]&quot;]
      def createboard(self):
          board = [&quot;[]&quot;,&quot;[]&quot;,&quot;[]&quot;,&quot;[]&quot;,&quot;[]&quot;,&quot;[]&quot;,&quot;[]&quot;,&quot;[]&quot;,&quot;[]&quot;]
          print(self.board[0],self.board[1],self.board[2])
          print(self.board[3],self.board[4],self.board[5])
          print(self.board[6],self.board[7],self.board[8])
      def checkwin(self):
          if self.board[0]==&quot;[O]&quot; and self.board[1]==&quot;[O]&quot; and self.board[2]==&quot;[O]&quot;:
              print(&quot;O Wins!&quot;)
              #break
          elif self.board[3]==&quot;[O]&quot;and self.board[4]==&quot;[O]&quot;and self.board[5]==&quot;[O]&quot;:
              print(&quot;O Wins!&quot;)
             # break
          elif self.board[6]==&quot;[O]&quot;and self.board[7]==&quot;[O]&quot;and self.board[8]==&quot;[O]&quot;:
              print(&quot;O Wins!&quot;)
             # break
          elif self.board[0]==&quot;[O]&quot;and self.board[3]==&quot;[O]&quot;and self.board[6]==&quot;[O]&quot;:
              print(&quot;O Wins!&quot;)
            #  break
          elif self.board[1]==&quot;[O]&quot;and self.board[4]==&quot;[O]&quot;and self.board[7]==&quot;[O]&quot;:
              print(&quot;O Wins!&quot;)
            #  break
          elif self.board[2]==&quot;[O]&quot;and self.board[5]==&quot;[O]&quot;and self.board[8]==&quot;[O]&quot;:
              print(&quot;O Wins!&quot;)
           #   break
          elif self.board[0]==&quot;[O]&quot;and self.board[4]==&quot;[O]&quot;and self.board[8]==&quot;[O]&quot;:
              print(&quot;O Wins!&quot;)
             # break
          elif self.board[2]==&quot;[O]&quot;and self.board[4]==&quot;[O]&quot;and self.board[6]==&quot;[O]&quot;:
              print(&quot;O Wins!&quot;)
            #  break
          elif self.board[0]==&quot;[X]&quot;and self.board[1]==&quot;[X]&quot;and self.board[2]==&quot;[X]&quot;:
              print(&quot;X Wins!&quot;)
             # break
          elif self.board[3]==&quot;[X]&quot;and self.board[4]==&quot;[X]&quot;and self.board[5]==&quot;[X]&quot;:
              print(&quot;X Wins!&quot;)
            #  break
          elif self.board[6]==&quot;[X]&quot;and self.board[7]==&quot;[X]&quot;and self.board[8]==&quot;[X]&quot;:
              print(&quot;X Wins!&quot;)
            #  break
          elif self.board[0]==&quot;[X]&quot;and self.board[3]==&quot;[X]&quot;and self.board[6]==&quot;[X]&quot;:
              print(&quot;X Wins!&quot;)
           #   break
          elif self.board[1]==&quot;[X]&quot;and self.board[4]==&quot;[X]&quot;and self.board[7]==&quot;[X]&quot;:
              print(&quot;X Wins!&quot;)
          #    break
          elif self.board[2]==&quot;[X]&quot;and self.board[5]==&quot;[X]&quot;and self.board[8]==&quot;[X]&quot;:
              print(&quot;X Wins!&quot;)
           #   break
          elif self.board[0]==&quot;[X]&quot;and self.board[4]==&quot;[X]&quot;and self.board[8]==&quot;[X]&quot;:
              print(&quot;X Wins!&quot;)
           #   break
          elif self.board[2]==&quot;[X]&quot;and self.board[4]==&quot;[X]&quot;and self.board[6]==&quot;[X]&quot;:
              print(&quot;O Wins!&quot;)
           #   break
          
      def omove(self):
          o = int(input(&quot;Its 'O's'move please insert 1-9&quot;))
          if o == 1:
              self.board[0] = &quot;[O]&quot;
              self.createboard()
          elif o == 2:
              self.board[1] = &quot;[O]&quot;
              self.createboard()
          elif o == 3:
              self.board[2] = &quot;[O]&quot;
              self.createboard()
          elif o == 4:
              self.board[3] = &quot;[O]&quot;
              self.createboard()
          elif o == 5:
              self.board[4] = &quot;[O]&quot;
              self.createboard()
          elif o == 6:
              self.board[5] = &quot;[O]&quot;
              self.createboard()
          elif o == 7:
              self.board[6] = &quot;[O]&quot;
              self.createboard()
          elif o == 8:
              self.board[7] = &quot;[O]&quot;
              self.createboard()
          elif o == 9:
              self.board[8] = &quot;[O]&quot;
              self.createboard()
          else:
              print('that column is out of range')
              o = int(input(&quot;please insert 1-9&quot;))
      def xmove(self):
          x = int(input(&quot;Its 'x's'move please insert 1-9&quot;))
          if x == 1:
              self.board[0] = &quot;[X]&quot;
              self.createboard()
          elif x == 2:
              self.board[1] = &quot;[X]&quot;
              self.createboard()
          elif x == 3:
              self.board[2] = &quot;[X]&quot;
              self.createboard()
          elif x == 4:
              self.board[3] = &quot;[X]&quot;
              self.createboard()
          elif x == 5:
              self.board[4] = &quot;[X]&quot;
              self.createboard()
          elif x == 6:
              self.board[5] = &quot;[X]&quot;
              self.createboard()
          elif x == 7:
              self.board[6] = &quot;[X]&quot;
              self.createboard()
          elif x == 8:
              self.board[7] = &quot;[X]&quot;
              self.createboard()
          elif x == 9:
              self.board[8] = &quot;[X]&quot;
              self.createboard()
          else:
              print('that column is out of range')
              o = int(input(&quot;please insert 1-9&quot;))
      
  a = Board()
  a.createboard()
  a.omove()
  a.checkwin()
  a.xmove()
  a.checkwin()
  a.omove()
  a.checkwin()
  a.xmove()
  a.checkwin()
  a.omove()
  a.checkwin()
  a.xmove()
  a.checkwin()
  a.omove()
  a.checkwin()
  a.xmove()
  a.checkwin()
  a.omove()
  a.checkwin()
  </code></pre>
  <p>I would love any kind of feedback to improve my skills in programming. What I thought about this is I think I used too much if condition maybe it can be swapped by another simple method and how can I even break when the game is finished ex: if X wins the game, the game is then closed</p>