- 281
- 1
- 7
Note: this is not the solution for the "Character Picture Grid" problem from Automate the Boring Stuff. Instead, this is an expansion of that problem simply for the sake of learningunderstanding nested loops, lists within lists, and iterating through values in order to print a picture on the screen.
Note: this is not the solution for the "Character Picture Grid" problem from Automate the Boring Stuff. Instead, this is an expansion of that problem simply for the sake of learning.
Note: this is not the solution for the "Character Picture Grid" problem from Automate the Boring Stuff. Instead, this is an expansion of that problem simply for the sake of understanding nested loops, lists within lists, and iterating through values in order to print a picture on the screen.
FirstlyNote: this is not the solution for the "Character Picture Grid" problem from Automate the Boring Stuff. Instead, thanksthis is an expansion of that problem simply for the sake of learning.
Thanks to anyone who takes the time to review this code. In short, shouldShould I comment more throughout my code so that it's easier to read? Are there ways to shorten this program so that it could run faster? I'm still quite new to programming.
The code below satisfies the Character picture exercise located at the end the following page: https://automatetheboringstuff.com/chapter4/
Say you have a list of lists where each value in the inner lists is a one-character string, like this:
grid = [['.', '.', '.', '.', '.', '.'], ['.', 'O', 'O', '.', '.', '.'], ['O', 'O', 'O', 'O', '.', '.'], ['O', 'O', 'O', 'O', 'O', '.'], ['.', 'O', 'O', 'O', 'O', 'O'], ['O', 'O', 'O', 'O', 'O', '.'], ['O', 'O', 'O', 'O', '.', '.'], ['.', 'O', 'O', '.', '.', '.'], ['.', '.', '.', '.', '.', '.']]
You can think of
grid[x][y]
as being the character at the x- and y-coordinates of a "picture" drawn with text characters. The(0, 0)
origin will be in the upper-left corner, the x-coordinates increase going right, and the y-coordinates increase going down.Copy the previous grid value, and write code that uses it to print the image.
..OO.OO.. .OOOOOOO. .OOOOOOO. ..OOOOO.. ...OOO... ....O....
Firstly, thanks to anyone who takes the time to review this code. In short, should I comment more throughout my code so that it's easier to read? Are there ways to shorten this program so that it could run faster? I'm still quite new to programming.
The code below satisfies the Character picture exercise located at the end the following page: https://automatetheboringstuff.com/chapter4/
Say you have a list of lists where each value in the inner lists is a one-character string, like this:
grid = [['.', '.', '.', '.', '.', '.'], ['.', 'O', 'O', '.', '.', '.'], ['O', 'O', 'O', 'O', '.', '.'], ['O', 'O', 'O', 'O', 'O', '.'], ['.', 'O', 'O', 'O', 'O', 'O'], ['O', 'O', 'O', 'O', 'O', '.'], ['O', 'O', 'O', 'O', '.', '.'], ['.', 'O', 'O', '.', '.', '.'], ['.', '.', '.', '.', '.', '.']]
You can think of
grid[x][y]
as being the character at the x- and y-coordinates of a "picture" drawn with text characters. The(0, 0)
origin will be in the upper-left corner, the x-coordinates increase going right, and the y-coordinates increase going down.Copy the previous grid value, and write code that uses it to print the image.
..OO.OO.. .OOOOOOO. .OOOOOOO. ..OOOOO.. ...OOO... ....O....
Note: this is not the solution for the "Character Picture Grid" problem from Automate the Boring Stuff. Instead, this is an expansion of that problem simply for the sake of learning.
Thanks to anyone who takes the time to review this. Should I comment more throughout my code so that it's easier to read? Are there ways to shorten this program so that it could run faster? I'm still quite new to programming.
Firstly, thanks to anyone who takes the time to review this code. In short, should I comment more throughout my code so that it's easier to read? Are there ways to shorten this program so that it could run faster? I'm still quite new to programming. So, overall, any advice you folks could offer would be greatly appreciated!
The code below satisfies the Character picture exercise located at the end the following page: https://automatetheboringstuff.com/chapter4/
Say you have a list of lists where each value in the inner lists is a one-character string, like this:
grid = [['.', '.', '.', '.', '.', '.'], ['.', 'O', 'O', '.', '.', '.'], ['O', 'O', 'O', 'O', '.', '.'], ['O', 'O', 'O', 'O', 'O', '.'], ['.', 'O', 'O', 'O', 'O', 'O'], ['O', 'O', 'O', 'O', 'O', '.'], ['O', 'O', 'O', 'O', '.', '.'], ['.', 'O', 'O', '.', '.', '.'], ['.', '.', '.', '.', '.', '.']]
You can think of
grid[x][y]
as being the character at the x- and y-coordinates of a "picture" drawn with text characters. The(0, 0)
origin will be in the upper-left corner, the x-coordinates increase going right, and the y-coordinates increase going down.Copy the previous grid value, and write code that uses it to print the image.
..OO.OO.. .OOOOOOO. .OOOOOOO. ..OOOOO.. ...OOO... ....O....
Firstly, thanks to anyone who takes the time to review this code. In short, should I comment more throughout my code so that it's easier to read? Are there ways to shorten this program so that it could run faster? I'm still quite new to programming. So, overall, any advice you folks could offer would be greatly appreciated!
Firstly, thanks to anyone who takes the time to review this code. In short, should I comment more throughout my code so that it's easier to read? Are there ways to shorten this program so that it could run faster? I'm still quite new to programming.
The code below satisfies the Character picture exercise located at the end the following page: https://automatetheboringstuff.com/chapter4/
Say you have a list of lists where each value in the inner lists is a one-character string, like this:
grid = [['.', '.', '.', '.', '.', '.'], ['.', 'O', 'O', '.', '.', '.'], ['O', 'O', 'O', 'O', '.', '.'], ['O', 'O', 'O', 'O', 'O', '.'], ['.', 'O', 'O', 'O', 'O', 'O'], ['O', 'O', 'O', 'O', 'O', '.'], ['O', 'O', 'O', 'O', '.', '.'], ['.', 'O', 'O', '.', '.', '.'], ['.', '.', '.', '.', '.', '.']]
You can think of
grid[x][y]
as being the character at the x- and y-coordinates of a "picture" drawn with text characters. The(0, 0)
origin will be in the upper-left corner, the x-coordinates increase going right, and the y-coordinates increase going down.Copy the previous grid value, and write code that uses it to print the image.
..OO.OO.. .OOOOOOO. .OOOOOOO. ..OOOOO.. ...OOO... ....O....