Staircase detail

This is a staircase of size $n=4$:

   #
  ##
 ###
####

Its base and height are both equal to $n$.  It is drawn using # symbols and spaces. The last line is not preceded by any spaces. 

Write a program that prints a staircase of size $n$.  

Function Description

Complete the staircase function in the editor below.  

staircase has the following parameter(s):  

int n: an integer  

Print  

Print a staircase as described above.  

Input Format

A single integer, $n$, denoting the size of the staircase.

Constraints

$0<n\leq100$ .  

Output Format

Print a staircase of size $n$ using # symbols and spaces.

Note: The last line must have $\mbox{0}$ spaces in it.  

Sample Input
6 

Sample Output
     #
    ##
   ###
  ####
 #####
######

Explanation

The staircase is right-aligned, composed of # symbols and spaces, and has a height and width of $n=6$.

Difficulty: EASY

Starter code:

Solutions:
n = int(input())
m = ' '
t = 1
while n > n - n:
	print((n - 1) * m + t * '#')
	n = n - 1
	t = t + 1


n = int(input())
for i in range(n):
	print(' ' * (n - i - 1), end='')
	print('#' * (i + 1))


levels = int(input())
for x in range(levels):
	x = x + 1
	spaces = ' ' * (levels - x)
	blocks = '#' * x
	out_str = (spaces + blocks).rstrip()
	print(out_str)


k = int(input())
for i in range(1, k + 1):
	p = ''
	for j in range(0, k - i):
		p += ' '
	for j in range(0, i):
		p += '#'
	print(p)


cnt = int(input())
for i in range(cnt):
	cnt_st = i + 1
	string = ''
	for inx in range(cnt - 1 - i):
		string = string + ' '
	for inx in range(cnt_st):
		string = string + '#'
	print(string)


def main(N):
	for i in range(1, N + 1):
		print((N - i) * ' ' + i * '#')
N = int(input())
main(N)


t = int(input())
for n in range(1, t + 1):
	print(' ' * (t - n) + '#' * n)


def stairs(height):
	for i in range(height):
		step = []
		for j in range(height - i - 1):
			step.append(' ')
		for j in range(i + 1):
			step.append('#')
		for char in step:
			print(char, end='')
		print('')
height = int(input())
stairs(height)


n = int(input())
for i in range(n):
	print(' ' * (n - i - 1) + '#' * (i + 1))


n = int(input())
for i in range(1, n + 1):
	print(' ' * (n - i) + i * '#')


N = int(input())
for i in range(N):
	spaces = ' ' * (N - (i + 1))
	hashes = '#' * (i + 1)
	print(spaces + hashes)


a = int(input())
for i in range(a):
	print(' ' * (a - i - 1) + '#' * (i + 1))


n = int(input())
for i in range(1, n + 1):
	j = n - i
	print(' ' * j, end='')
	print('#' * i)


n = int(input())
for i in range(1, n + 1):
	print(' ' * (n - i) + '#' * i)


n = int(input())
for i in range(1, n + 1):
	print(' ' * (n - i) + '#' * i)


n = int(input())
for i in range(1, n + 1):
	print(''.join((' ' for x in range(n - i))), end='')
	print(''.join(('#' for x in range(i))))


n = int(input())
row = ''
for i in range(0, n):
	for j in range(0, n):
		if j < n - i - 1:
			row += ' '
		else:
			row += '#'
	print(row)
	row = ''


height = int(input())
for level in range(1, height + 1):
	print(' ' * (height - level) + '#' * level)


cases = int(input())
for i in range(1, cases + 1):
	print((cases - i) * ' ' + i * '#')


N = input()
N = int(N)
for row in range(1, N + 1):
	print(' ' * (N - row) + '#' * row)


n = int(input())
for i in range(1, n + 1):
	print(' ' * (n - i), '#' * i, sep='')


n = int(input())
for i in range(n):
	print(' ' * (n - (i + 1)) + '#' * (i + 1))


N = int(input())
for i in range(0, N):
	print(' ' * (N - i - 1) + '#' * (1 + i))


nStairs = int(input())
listStairs = list()
strInput1 = str('#')
strInput2 = str(' ')
nMax = nStairs + 1
for i in range(1, nMax):
	strInput = strInput2 * (nStairs - i) + strInput1 * i
	listStairs.append(strInput)
for i in range(len(listStairs)):
	print(listStairs[i])


x = int(input())
for i in range(1, x + 1):
	print(' ' * (x - i), '#' * i, sep='')


import fileinput
input_list = []
for line in fileinput.input():
	input_list.append(int(line))
steps = input_list[0]
for x in range(1, steps + 1):
	step = ''
	for y in range(steps - x):
		step += ' '
	for z in range(x):
		step += '#'
	print(step)


height = int(input())
for i in range(height):
	j = i + 1
	row = ' ' * (height - j) + '#' * j
	print(row)


stairs = int(input())
spaces = stairs - 1
for step in range(stairs):
	print(' ' * spaces + '#' * (stairs - spaces))
	spaces -= 1


s = '#'
n = int(input())
d = n
for x in range(1, n + 1):
	d = d - 1
	print('%s%s' % (' ' * d, s * x))


N = int(input())
for i in range(N):
	print(' ' * (N - i - 1) + '#' * (i + 1))


n = int(input())
for i in range(n):
	print(' ' * (n - i - 1), end='')
	print('#' * (i + 1))


N = int(input())
for i in range(1, N + 1):
	print(' ' * (N - i) + i * '#')


height = int(input())
for i in range(height):
	print(' ' * (height - i - 1) + '#' * (i + 1))


n = int(input())
for each in range(n):
	for sp in range(n - each - 1):
		print(end=' ')
	for sym in range(each + 1):
		print('#', end='')
	print()


n = int(input())
for i in range(1, n + 1):
	print(str(' ') * (n - i) + str('#') * i)


height = int(input())
level = height
while level > 0:
	output = ''
	for i in range(0, level - 1):
		output += ' '
	for i in range(level, height + 1):
		output += '#'
	level -= 1
	print(output)


N = int(input())
print('\n'.join((' ' * (N - i) + '#' * i for i in range(1, N + 1))))


N = int(input())
level = ''
for i in range(N):
	level = level + '#'
	print('{0:>{width}s}'.format(level, width=N))


height = int(input())
for i in range(height):
	num_hash = i + 1
	print(' ' * (height - num_hash) + '#' * num_hash)


n = int(input())
for i in range(1, n + 1):
	print(' ' * (n - i) + '#' * i)


N = int(input())
M = N - 1
while M >= 0:
	print(' ' * M + '#' * (N - M))
	M -= 1


height = int(input())
for line in range(1, height + 1):
	print('{:>{height}}'.format('#' * line, height=height))


size = int(input())
for i in range(1, size + 1):
	print(' ' * (size - i) + '#' * i)


steps = int(input())
for i in range(1, steps + 1):
	print(' ' * (steps - i) + '#' * i)


n = int(input())
for x in range(1, n + 1):
	print(' ' * (n - x) + '#' * x)


n = int(input())
str1 = ''
for i in range(0, n):
	str1 = ''
	for k in range(0, n - 1 - i):
		str1 += ' '
	for j in range(n - i - 1, n):
		str1 += '#'
	print(str1)


def spaceAndStar(nSp, nSt):
	temp = ''
	if 0 != nSp:
		for P in range(nSp):
			temp = temp + ' '
	for P in range(nSt):
		temp = temp + '#'
	return temp
n = int(input())
for P in range(1, n + 1):
	print(spaceAndStar(n - P, P))


n = int(input())
for s in range(n):
	p = n - s - 1
	print(str(' ') * p + str('#') * (s + 1))


levels = int(input())
for i in range(1, levels + 1):
	spaces = levels - i
	output = ' ' * spaces + '#' * i
	print(output)


n = int(input())
for i in range(1, n + 1):
	print(''.join([' '] * (n - i)) + ''.join(['#'] * i))


n = int(input())
for i in range(1, n + 1):
	print(' ' * (n - i) + '#' * i)


n = int(input())
for i in range(n):
	for s in range(n - i - 1):
		print(' ', end='')
	for s in range(i + 1):
		print('#', end='')
	print('')


N = int(input())
for i in range(1, N + 1):
	print((N - i) * ' ' + i * '#')


n = int(input())
for i in range(n):
	line = ''
	for j in range(n - i - 1):
		line += ' '
	for j in range(i + 1):
		line += '#'
	print(line)


n = int(input())
i = 0
j = n - 1
while i < n:
	for x in range(j):
		print(' ', end='')
	for y in range(n - j):
		print('#', end='')
	print()
	j = j - 1
	i = i + 1


height = int(input())
print('\n'.join([('#' * n).rjust(height) for n in range(1, height + 1)]))


size = int(input())
spaces = size - 1
for x in range(0, size):
	for y in range(0, spaces):
		print(' ', end='')
	for z in range(spaces, size):
		print('#', end='')
	spaces -= 1
	print('')


n = int(input())
s = '#'
for i in range(0, n):
	print(s.rjust(n, ' '))
	s = s + '#'


h = int(input())
for i in range(1, h + 1):
	for k in range(0, h - i):
		print(' ', end='')
	for j in range(0, i):
		print('#', end='')
	print()


n = int(input())
for i in range(1, n + 1):
	if i < n:
		print(' ' * (n - i) + '#' * i)
	elif i == n:
		print('#' * i)


N = int(input())
for x in range(1, N + 1):
	line = ''
	line += ''.join([' ' for _ in range(N - x)])
	line += ''.join(['#' for _ in range(x)])
	print(line)


N = int(input())
for i in range(N):
	print(' ' * (N - i - 1) + '#' * (i + 1))


n = int(input())
s = ''
for i in range(n):
	s = ''
	for j in range(n):
		if j < n - 1 - i:
			s += ' '
		else:
			s += '#'
	print(s)


n = int(input())
for i in range(1, n + 1):
	print(' ' * (n - i), '#' * i, sep='')


n = int(input())
for i in range(n):
	s = (n - (i + 1)) * ' ' + (i + 1) * '#'
	print(s)


n = int(input())
a = [' '] * n
for i in range(0, n):
	a[n - (i + 1)] = '#'
	print(''.join(a))


n = int(input())
for i in range(1, n + 1):
	print((n - i) * ' ' + i * '#')


n = int(input())
for i in range(1, n + 1):
	print(' ' * (n - i) + '#' * i)


import sys
N = int(sys.stdin.readline())
for i in range(1, N + 1):
	print((N - i) * ' ' + i * '#')


size = int(input())
for i in range(1, size + 1):
	print('%s%s' % (' ' * (size - i), '#' * i))


height = int(input())
for each in range(1, height + 1):
	print(' ' * (height - each) + '#' * each)


def staircase(n):
	i = n - 1
	while i >= 0:
		print(' ' * i + '#' * (n - i))
		i = i - 1
num = int(input())
staircase(num)


x = int(input())
y = x - 1
for i in range(x):
	print(' ' * y + '#' * (i + 1))
	y -= 1


N = int(input())
for i in range(1, N + 1):
	print(' ' * (N - i) + '#' * i)


def print_line(line_length, rung):
	return ''.join(['#' if i >= line_length - rung - 1 else ' ' for i in range(0, line_length)])
height = int(input())
for rung in range(0, height):
	print(print_line(height, rung))


n = int(input())
for index in range(n):
	print(' ' * (n - (index + 1)) + '#' * (index + 1))


n = int(input())
for i in range(0, n):
	print(' ' * (n - 1 - i) + '#' * (i + 1))


size = int(input())
for line in range(0, size):
	ladder = ''
	for i in range(0, size - line - 1):
		ladder += ' '
	for i in range(0, line + 1):
		ladder += '#'
	print(ladder)


t = int(input())
i = t
j = t
str = ''
while j > 0:
	i = t
	while i > 0:
		if i + j <= t + 1:
			str += '#'
		else:
			str += ' '
		i = i - 1
	str += '\n'
	j = j - 1
print(str)


hoogte = int(input())
teller = 1
while hoogte >= teller:
	if teller == hoogte:
		print('#' * teller)
	else:
		print(' ' * (hoogte - teller - 1), '#' * teller)
	teller += 1


N = int(input())
for i in range(N):
	print(' ' * (N - i - 1) + '#' * (i + 1))


import sys
n = int(input())
for i in range(1, n + 1):
	for j in range(1, n + 1):
		if j < n - i + 1:
			print(' ', end='')
		if j >= n - i + 1:
			print('#', end='')
	print('\n', end='')


n = int(input())
for i in range(0, n):
	staircase = ''
	for j in range(0, n - i - 1):
		staircase += ' '
	for k in range(n - i - 1, n):
		staircase += '#'
	print(staircase)


n = int(input())
s = '#'
st = ''
for i in range(n):
	st += s
	print(st.rjust(n))


n = int(input())
for i in range(n):
	print(' ' * (n - i - 1) + '#' * (i + 1))


import sys
n = int(sys.stdin.readline())
for i in range(1, n + 1, 1):
	for j in range(n - i):
		print(' ', sep='', end='')
	for j in range(1, i + 1, 1):
		print('#', sep='', end='')
	print()


n = int(input())
for i in range(n):
	print((' ' * (n - i - 1)).ljust(n, '#'))


n = int(input())
for i in range(1, n + 1):
	print(' ' * (n - i), end='')
	print('#' * i)


A = list(map(lambda x: '#' * (x + 1), range(int(input()))))
B = list(map(lambda x: ' ' * (x - 1), range(len(A), 0, -1)))
list(map(print, list(map(lambda x: x[1] + x[0], zip(A, B)))))


N = int(input())
for i in range(0, N):
	print(' ' * (N - i - 1), end='')
	print('#' * (i + 1))


N = int(input())
space = list(range(N - 1, -1, -1))
hash = list(range(1, N + 1))
for (a, b) in zip(space, hash):
	answer = ' ' * a + '#' * b
	print(answer)


N = int(input())
for i in range(0, N):
	print(' ' * (N - 1 - i) + '#' * (1 + i))


steps = int(input())
for i in range(steps):
	print(' ' * (steps - 1 - i) + '#' * (i + 1))


n = int(input())
for i in range(1, n + 1):
	print(' ' * (n - i) + '#' * i)


size = int(input())
for i in range(size):
	print(''.ljust(size - (i + 1)) + '#' * (i + 1))


n = int(input())
for i in range(n):
	s = ''
	for j in range(n - 1 - i):
		s += ' '
	for k in range(i + 1):
		s += '#'
	print(s)


height = int(input())
for step in range(1, height + 1):
	print(' ' * (height - step) + '#' * step)


n = int(input())
for i in range(1, n + 1):
	print(' ' * (n - i) + '#' * i)


n = int(input())
for i in range(n):
	print(' ' * (n - i - 1), end='')
	for j in range(i + 1):
		print('#', end='')
	print()