Created
July 12, 2016 17:23
-
-
Save KHerb/0ef9ff2b6f3cf92ba26fee10407d481f to your computer and use it in GitHub Desktop.
Gameboard Generator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Gameboard Generator""" | |
columns = int(raw_input("How many columns do you want on your gameboard? ")) | |
rows = int(raw_input("How many rows do you want on your gameboard? ")) | |
def gameboard(columns,rows): | |
column = [] | |
height = [] | |
for i in range(columns): | |
column.append("| |") | |
for i in range(columns): | |
height.append(" ---- ") | |
for i in range(rows): | |
print "".join(height) | |
print "".join(column) | |
print "".join(height) | |
return column,height | |
gameboard(columns,rows) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
That's quite good. I did the exercise and your solution is simpler than mine.
I amended it a bit to take out a bug -> https://gist.github.com/BensonMuriithi/24cde0031cf7fb94fa68fc62083d7cac