-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcharacter_picture_grid.py
More file actions
33 lines (26 loc) · 1.39 KB
/
character_picture_grid.py
File metadata and controls
33 lines (26 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Character Grid Printing using Python
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', '.', '.', '.'],
['.', '.', '.', '.', '.', '.']]
for i in range(len(grid[0])): # grid[0]= 8 integers taken as in range
print()
for j in range(len(grid)):
print(grid[j][i], end = '')
for i in range(len(grid[0])): # range(5) will increase every time with 1
print() # will create a new line every time after each iteration
for j in range(len(grid)): # range(8) will increase every time with 1
print((j,i), end = '') #first iteration will be like (j = 0, i = 0)
# for i in range(3):
# print("First for Loop.")
# for j in range(5):
# print("Second Loop.")
# for i in range(5): # In the loop under loop construction the first loop starts but then the inner loop takes control and then the first loop will only iterate when the inner loop finish its iteration and it will till for the inner loop to end his iteration. This is the best which can easily prove the statement.
# print() # it is to make new line for every iteration so that we can get the desired output in the desired format
# for j in range(8):
# print((j,i ), end = '')