-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path4_2.py
More file actions
35 lines (26 loc) · 720 Bytes
/
4_2.py
File metadata and controls
35 lines (26 loc) · 720 Bytes
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
35
def make_ruler(_len):
temp = ("|...")
top = temp*_len + "|"
bot = ""
for i in range(0, _len+1):
if i < 9:
bot += str(i) + " "
else:
bot += str(i) + " "
ruler = top + "\n" + bot
return ruler
def make_grid(x, y):
result = ""
for i in range(0, y):
result = result + "+---" * x + "+\n"
result = result + "| " * x + "|\n"
result = result + "+---" * x + "+\n"
return result
if __name__ == "__main__":
#RULER
_len = int( input("Enter a length of the ruler: ") )
print( make_ruler(_len) )
#GRID
x = int( input("Enter width: ") )
y = int( input("Enter height: ") )
print( make_grid(x, y) )