Last active
July 29, 2021 04:29
-
-
Save qmmr/ace1346a55101a7cc4f6df9fe24c945e to your computer and use it in GitHub Desktop.
Revisions
-
qmmr revised this gist
Mar 3, 2019 . 1 changed file with 11 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -15,9 +15,11 @@ def create_board(rows, columns): max_columns = 130 max_rows = 11 rows = int(rows) columns = int(columns) if columns <= max_columns and rows <= max_rows: for row in range(rows): if row % 2 == 0: for col in range(1, columns): @@ -34,6 +36,14 @@ def create_board(rows, columns): return True else: # Return False when matrix is not fitting the screen reason = "" if columns > max_columns and rows > max_rows: reason = "columns and rows" elif columns > max_columns: reason += "columns" elif rows > max_rows: reason += "rows" print("Sorry, cannot create the board, too many {0:s}.".format(reason)) return False -
qmmr revised this gist
Mar 1, 2019 . 1 changed file with 4 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -15,10 +15,12 @@ def create_board(rows, columns): rows = int(rows) columns = int(columns) if columns <= 130: for row in range(rows): if row % 2 == 0: for col in range(1, columns): if col % 2 == 1: if col != columns - 1: print(" ", end="") -
qmmr revised this gist
Mar 1, 2019 . 1 changed file with 28 additions and 4 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -4,11 +4,35 @@ Python Homework Assignment #6: Advanced Loops Details: Create a function that takes in two parameters: rows, and columns, both of which are integers. The function should then proceed to draw a playing board (as in the examples from the lectures) the same number of rows and columns as specified. After drawing the board, your function should return True. Extra Credit: Try to determine the maximum width and height that your terminal and screen can comfortably fit without wrapping. If someone passes a value greater than either maximum, your function should return Talse. """ def create_board(rows, columns): if columns <= 130: for row in range(int(rows)): if row % 2 == 0: for col in range(1, int(columns)): if col % 2 == 1: if col != columns - 1: print(" ", end="") else: print(" ") else: print("|", end="") else: print("-" * columns) # After drawing is done return True return True else: # Return False when matrix is not fitting the screen return False create_board(11, 130) -
qmmr created this gist
Feb 28, 2019 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ """ pirple.com/python Python Homework Assignment #6: Advanced Loops Details: Create a function that takes in two parameters: rows, and columns, both of which are integers. The function should then proceed to draw a playing board (as in the examples from the lectures) the same number of rows and columns as specified. After drawing the board, your function should return True. Extra Credit: Try to determine the maximum width and height that your terminal and screen can comfortably fit without wrapping. If someone passes a value greater than either maximum, your function should return Talse. """