Staircase 🟡
Contents
Staircase 🟡#
Write a function that returns a staircase with
nsteps using the hash#and underscore_symbols.
Rules#
The number of steps are either positive or negative values.
Function returns a
string.The steps are adjoined with the newline character
\nA positive number of step denotes the staircase’s upward direction.
A negative number of step denotes the staircase’s downward direction.
Example#
Upward staircase#
staircase(3)
output:
"__#\n_##\n###"
or
print(staircase(3))
output:
__#
_##
###
Downward staircase#
staircase(-5)
output:
"#####\n_####\n__###\n___##\n____#"
or
print(staircase(-5))
output:
#####
_####
__###
___##
____#