forked from rahulraghavendhra/HackerRank-Python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
staircase.py
39 lines (32 loc) · 926 Bytes
/
staircase.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
"""
Problem Statement
Your teacher has given you the task of drawing a staircase structure. Being an expert programmer, you decided to make a program to draw it for you instead. Given the required height, can you print a staircase as shown in the example?
Input
You are given an integer N depicting the height of the staircase.
Output
Print a staircase of height N that consists of # symbols and spaces. For example for N=6, here's a staircase of that height:
#
##
###
####
#####
######
Note: The last line has 0 spaces before it.
"""
# Complete the function below.
def StairCase(n):
for i in range(1,n+1):
stair_array = []
j = 1
while(j <= n):
if(j <= i):
stair_array.append('#')
else:
stair_array.append(' ')
j = j + 1
reversed_array = list(reversed(stair_array))
for element in reversed_array:
print(element),
print
_n = int(raw_input().strip("\n"))
StairCase(_n)