.
This commit is contained in:
46
bac1/q1/renforcement/renforcement_2510/ex2.py
Normal file
46
bac1/q1/renforcement/renforcement_2510/ex2.py
Normal file
@ -0,0 +1,46 @@
|
||||
def ask_row_column_amount():
|
||||
"""just ask row and column and amount and return it
|
||||
:returns: (row, culumn, amount)
|
||||
|
||||
"""
|
||||
row, column = tuple(input().split())
|
||||
rect_amount = input()
|
||||
return row, column, rect_amount
|
||||
|
||||
|
||||
def add_rectangle(screen):
|
||||
"""add a rectangle to the screen
|
||||
|
||||
:screen: TODO
|
||||
:returns: TODO
|
||||
|
||||
"""
|
||||
x1, y1, x2, y2, char = tuple(input().split())
|
||||
for i in range(int(x1), int(x2)):
|
||||
for j in range(int(y1), int(y2)):
|
||||
screen[i][j] = char
|
||||
|
||||
|
||||
def draw(screen):
|
||||
"""draw the matrix
|
||||
|
||||
:screen: TODO
|
||||
:returns: TODO
|
||||
|
||||
"""
|
||||
for i in screen:
|
||||
for j in i:
|
||||
print(j, end='')
|
||||
print()
|
||||
|
||||
|
||||
def main():
|
||||
r, c, a = ask_row_column_amount()
|
||||
screen = [['.' for i in range(int(r))] for j in range(int(c))]
|
||||
for i in range(int(a)):
|
||||
add_rectangle(screen)
|
||||
draw(screen)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
Reference in New Issue
Block a user