-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPythonHomework#6
34 lines (28 loc) · 922 Bytes
/
PythonHomework#6
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
34
import shutil
rowSep="-"
colSep="|"
maxWidth = shutil.get_terminal_size().columns
maxHeight = shutil.get_terminal_size().lines
def board(boardSize):
boardSize = int(boardSize)
if boardSize > maxWidth or boardSize > maxHeight:
return False
else:
for row in range(boardSize):
if row%2 == 1:
print(rowSep * (boardSize))
else:
for col in range(boardSize):
if col%2 == 1:
if col == boardSize -1:
print(colSep)
else:
print(colSep,end="")
else:
if col == boardSize -1:
print(" ")
else:
print(" ",end="")
return True
size = input("desired board size? >: ")
print(board(size))