I wont extend much, I just have one thing for you. It is nice to comment and give explanations about what you are doing, really nice. You'll see that when you review your code 3-4 months in the future those comments will help you.
print_board(board) # Prints the board
This comment tho... give explanations about what you feel needs explanation, don't overdo it. You don't need to annotate every line, documentation is other thing.
def print_board(board):
for row in board:
print " ".join(row)
# This function iterates through each "O" list and adds a space between
# This iteration prints on a new line every time a new sub-list is found
The proper way of doing this is:
def print_board(board):
"""Takes board as argument, iterates through each "O" list and adds a space in between"""
print ("\n".join([" ".join(row) for row in board])) # This line need explanation maybe :S
This is called a documentation string, you can read some conventions in [PEP257][1]PEP257 (nothing will change in your life if you start reading PEPs btw) the good thing about this is that you can call help()
on that function and that docstring will magically appear, i.e:
help(print_board)
Help on function print_board in module __main__:
print_board(board)
Takes board as argument, iterates through each "O" list and adds a space in between
There are a lot of good things about docstrings, they let you build formated documentation, your IDE will look at them and provide you with some info, they are nice to you, be nice to them.
Hope it helps! [1]: https://www.python.org/dev/peps/pep-0257/#what-is-a-docstring
I wont extend much, I just have one thing for you. It is nice to comment and give explanations about what you are doing, really nice. You'll see that when you review your code 3-4 months in the future those comments will help you.
print_board(board) # Prints the board
This comment tho... give explanations about what you feel needs explanation, don't overdo it. You don't need to annotate every line, documentation is other thing.
def print_board(board):
for row in board:
print " ".join(row)
# This function iterates through each "O" list and adds a space between
# This iteration prints on a new line every time a new sub-list is found
The proper way of doing this is:
def print_board(board):
"""Takes board as argument, iterates through each "O" list and adds a space in between"""
print ("\n".join([" ".join(row) for row in board])) # This line need explanation maybe :S
This is called a documentation string, you can read some conventions in [PEP257][1] (nothing will change in your life if you start reading PEPs btw) the good thing about this is that you can call help()
on that function and that docstring will magically appear, i.e:
help(print_board)
Help on function print_board in module __main__:
print_board(board)
Takes board as argument, iterates through each "O" list and adds a space in between
There are a lot of good things about docstrings, they let you build formated documentation, your IDE will look at them and provide you with some info, they are nice to you, be nice to them.
Hope it helps! [1]: https://www.python.org/dev/peps/pep-0257/#what-is-a-docstring
I wont extend much, I just have one thing for you. It is nice to comment and give explanations about what you are doing, really nice. You'll see that when you review your code 3-4 months in the future those comments will help you.
print_board(board) # Prints the board
This comment tho... give explanations about what you feel needs explanation, don't overdo it. You don't need to annotate every line, documentation is other thing.
def print_board(board):
for row in board:
print " ".join(row)
# This function iterates through each "O" list and adds a space between
# This iteration prints on a new line every time a new sub-list is found
The proper way of doing this is:
def print_board(board):
"""Takes board as argument, iterates through each "O" list and adds a space in between"""
print ("\n".join([" ".join(row) for row in board])) # This line need explanation maybe :S
This is called a documentation string, you can read some conventions in PEP257 (nothing will change in your life if you start reading PEPs btw) the good thing about this is that you can call help()
on that function and that docstring will magically appear, i.e:
help(print_board)
Help on function print_board in module __main__:
print_board(board)
Takes board as argument, iterates through each "O" list and adds a space in between
There are a lot of good things about docstrings, they let you build formated documentation, your IDE will look at them and provide you with some info, they are nice to you, be nice to them.
Hope it helps!
I wont extend much, I just have one thing for you. It is nice to comment and give explanations about what you are doing, really nice. You'll see that when you review your code 3-4 months in the future those comments will help you.
print_board(board) # Prints the board
This comment tho... give explanations about what you feel needs explanation, don't overdo it. You don't need to annotate every line, documentation is other thing.
def print_board(board):
for row in board:
print " ".join(row)
# This function iterates through each "O" list and adds a space between
# This iteration prints on a new line every time a new sub-list is found
The proper way of doing this is:
def print_board(board):
"""Takes board as argument, iterates through each "O" list and adds a space in between"""
print ("\n".join([" ".join(row) for row in board])) # This line need explanation maybe :S
This is called a documentation string, you can read some conventions in [PEP257][1] (nothing will change in your life if you start reading PEPs btw) the good thing about this is that you can call help()
on that function and that docstring will magically appear, i.e:
help(print_board)
Help on function print_board in module __main__:
print_board(board)
Takes board as argument, iterates through each "O" list and adds a space in between
There are a lot of good things about docstrings, they let you build formated documentation, your IDE will look at them and provide you with some info, they are nice to you, be nice to them.
Hope it helps! [1]: https://www.python.org/dev/peps/pep-0257/#what-is-a-docstring
I wont extend much, I just have one thing for you. It is nice to comment and give explanations about what you are doing, really nice. You'll see that when you review your code 3-4 months in the future those comments will help you.
print_board(board) # Prints the board
This comment tho... give explanations about what you feel needs explanation, don't overdo it. You don't need to annotate every line, documentation is other thing.
def print_board(board):
for row in board:
print " ".join(row)
# This function iterates through each "O" list and adds a space between
# This iteration prints on a new line every time a new sub-list is found
The proper way of doing this is:
def print_board(board):
"""Takes board as argument, iterates through each "O" list and adds a space in between"""
print ("\n".join([" ".join(row) for row in board])) # This line need explanation maybe :S
This is called a documentation string, you can read some conventions in [PEP257][1] (nothing will change in your life if you start reading PEPs btw) the good thing about this is that you can call help()
on that function and that docstring will magically appear, i.e:
help(print_board)
Help on function print_board in module __main__:
print_board(board)
Takes board as argument, iterates through each "O" list and adds a space in between
Hope it helps! [1]: https://www.python.org/dev/peps/pep-0257/#what-is-a-docstring
I wont extend much, I just have one thing for you. It is nice to comment and give explanations about what you are doing, really nice. You'll see that when you review your code 3-4 months in the future those comments will help you.
print_board(board) # Prints the board
This comment tho... give explanations about what you feel needs explanation, don't overdo it. You don't need to annotate every line, documentation is other thing.
def print_board(board):
for row in board:
print " ".join(row)
# This function iterates through each "O" list and adds a space between
# This iteration prints on a new line every time a new sub-list is found
The proper way of doing this is:
def print_board(board):
"""Takes board as argument, iterates through each "O" list and adds a space in between"""
print ("\n".join([" ".join(row) for row in board])) # This line need explanation maybe :S
This is called a documentation string, you can read some conventions in [PEP257][1] (nothing will change in your life if you start reading PEPs btw) the good thing about this is that you can call help()
on that function and that docstring will magically appear, i.e:
help(print_board)
Help on function print_board in module __main__:
print_board(board)
Takes board as argument, iterates through each "O" list and adds a space in between
There are a lot of good things about docstrings, they let you build formated documentation, your IDE will look at them and provide you with some info, they are nice to you, be nice to them.
Hope it helps! [1]: https://www.python.org/dev/peps/pep-0257/#what-is-a-docstring
I wont extend much, I just have one thing for you. It is nice to comment and give explanations about what you are doing, really nice. You'll see that when you review your code 3-4 months in the future those comments will help you.
print_board(board) # Prints the board
This comment tho... give explanations about what you feel needs explanation, don't overdo it. You don't need to annotate every line, documentation is other thing.
def print_board(board):
for row in board:
print " ".join(row)
# This function iterates through each "O" list and adds a space between
# This iteration prints on a new line every time a new sub-list is found
The proper way of doing this is:
def print_board(board):
"""Takes board as argument, iterates through each "O" list and adds a space in between"""
print ("\n".join([" ".join(row) for row in board])) # This line need explanation maybe :S
This is called a documentation string, you can read some conventions in [PEP257][1] (nothing will change in your life if you start reading PEPs btw) the good thing about this is that you can call help()
on that function and that docstring will magically appear, i.e:
help(print_board)
Help on function print_board in module __main__:
print_board(board)
Takes board as argument, iterates through each "O" list and adds a space in between
Hope it helps! [1]: https://www.python.org/dev/peps/pep-0257/#what-is-a-docstring