Skip to content

Python syntax

Maciej Jankowski edited this page Jun 3, 2019 · 4 revisions

You can learn the basics of syntax here:

After reading this you should know about:

  • statements
  • expressions
  • if, for, while

For now I will use the code we written using Flowcharts and translate it into python:

player1_name = ""
player2_name = ""

def draw_board():
  pass

def ask_for_position_X():
  # return position
  pass 

def put_X_on_the_board(position):
  pass

def is_game_over():
#  if no_moves_left() or row_of_3():
#    return true
#  else:
    return False

def new_round():
  pass

def show_winner():
  pass

def no_moves_left():
  return False

def row_of_3():
  pass

After we have all the pieces we should Code the functions

Clone this wiki locally