-
Notifications
You must be signed in to change notification settings - Fork 0
/
pyramid.py
271 lines (163 loc) · 4.73 KB
/
pyramid.py
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
# Mario Pyramid - Richard Weaver
# (11/02/22)
height=0
row=0
block = "# "
spaces = " "
# User input for height value
height = int(input("What height should the pyramid be? -> "))
while height < 1 or height > 23:
# print("Invalid Height: Please provide a new height")
height = int(input("What height should the pyramid be? -> "))
# Creating Pyramid with nested for loops
for row in range (height):
height-=1
row+=1
print(spaces * (height), end=block * (row))
for row in range (height):
row+=1
print(block*row)
break
print("#")
# height=0
# row=0
# block = "# "
# spaces = " "
# height = int(input("What height should the pyramid be? -> "))
# while height < 1 or height > 23:
# print("Invalid Height: Please provide a new height")
# height = int(input("What height should the pyramid be? -> "))
# # height -=1
# # row +=1
# for i in range (1, row):
# num = 1
# for j in range (1,-1):
# print(spaces)
# height -=1
# if height == row:
# print(end=block)
# # elif height
# row+=1
# print(spaces * (height), end=block * (row+1))
# print("")
# for row in range (height:
# print(spaces)
# row+=1
# for row in range (height):
# row+=1
# print(block*row)
# break
# print("#")
# , end=block)
# for row in range (height):
# height-=1
# print(end=block)
# print(block*height)
# print(row)
# print(spaces * (height-1))
# print(block*row)
# for height in range (height):
# height -=1
# row +=1
# print(end = block)
# for row in range (height):
# print(end = block)
# for row in range (height):
# row+=1
# print(end= (block))
# for row in range (row):
# print(block)
# print(end=block)
# for height in range(height):
# print(end = block)
# row+=1
# print(block * row)
# for height in range(0, height):
# print(end= spaces * height)
# print(row)
# print(height)
##space characters before block = (height) - (row)!!!
# for height in range(1,height):
# row+=1
# print(spaces)
# for row in range (height):
# print(block)
# print(spaces, end="")
# print(block)
# print(space * 8, end="")
# print(block * 2)
# print(space * height, end=" ")
# print(block)
# for row in range (height+1):
# print(block)
# print(block)
##spaces = (height*2) - (row*2)
###This seems to be a solution for it...:
# for width in range(height):
# space = " " * (height - width)
# block = (width + 1) * "#"
# print(space+block)
# print(" " * (height - 1)), # Print spaces precluding hashes
# print(" #" * (height + 2)) # Two hashes for start of pyramid
# height -= 1 # Subtracts one space for every iteration
# print(" " * (height+1)
# block*height)
# for width in range (0,height+1):
# print(f" {block}")
# for height in range (0,height):
# print(space * height)
# for width in range (0,height):
# height +=1
# for height in range(0,height+1):
# print(" ")
# for width in range(0,height+1):
# print("done")
# for width in range(1,24):
# print(space)
# if height > width:
# break
# for width in range (1, height):
# print("done")
# for width in range(1, height):
# print(block * width)
# print(width * block)
# for width in range (1,24)
# height += 1
# width += 1
# print(block * block)
# for height in range (1,24):
# print(block * width)
# pyramid += 1
# for width in range (1,height):
# print(block * width)
# if height < max_blocks and height >= 0:
# pyramid = block * height
# print(pyramid)
# print(height)
# if height > max_blocks:
# print("Invalid Height: Please provide a new height")
# else:
# print(block)
# break
# height = int(input("What height should the pyramid be? -> "))
# if height > max_blocks or height <= min_blocks:
# print("Invalid Height: Please provide a new height")
# height = int(input("What height should the pyramid be? -> "))
# break
# else:
# print(height)
# # while blocks 0:
# # print(blocks)
# # if blocks > max_blocks or blocks < min_blocks:
# # print("no")
# blocks = "# "
#
# if 0 < x < 23:
# print(x)
# x = input("What height should the pyramid be? -> ")
# if input > 23:
# print("invalid height")
# print(height_input)
# while height_input in range (0, 23):
# blocks += 1
# print(blocks * height_input)