We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 15ce2f6 commit 79bccf8Copy full SHA for 79bccf8
character_pyramid.py
@@ -7,21 +7,13 @@
7
pyramid_character = raw_input("Enter some text: ")
8
pyramid_size = int(raw_input("And the size of your side word pyramid: "))
9
10
+
11
def create_pyramid(character, size):
12
""" Prints a sideword pyramid """
- loop_counter = 1
13
- increment = 1
14
- while loop_counter > 0:
15
- if increment:
16
- print character * loop_counter
17
- loop_counter += 1
18
- if loop_counter == size:
19
- # You've reached the top, start heading down the other side
20
21
- increment = 0
22
- else:
23
- loop_counter -= 1
24
+ for i in range(1, size + 1):
+ print character * i
+ for i in range(size -1 , 1, -1):
25
26
27
create_pyramid(pyramid_character, pyramid_size)
0 commit comments