From 6dfd09ff517aa349bc94d3a073c137b7f19358d5 Mon Sep 17 00:00:00 2001 From: Ubaidullah Khan <33365560+ubaidsworld@users.noreply.github.com> Date: Mon, 13 Nov 2017 15:12:40 +0530 Subject: [PATCH] simplified coding. Just make the complex code little simpler in few lines. --- staircase.py | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/staircase.py b/staircase.py index 5547aff..d6773e7 100644 --- a/staircase.py +++ b/staircase.py @@ -21,19 +21,9 @@ 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 + for i in range(1, n + 1): + print ' '*(n-i) + '#'*i + + _n = int(raw_input().strip("\n")) StairCase(_n)