Staircase 🟡#

Write a function that returns a staircase with n steps using the hash # and underscore _ symbols.

Rules#

  1. The number of steps are either positive or negative values.

  2. Function returns a string.

  3. The steps are adjoined with the newline character \n

  4. A positive number of step denotes the staircase’s upward direction.

  5. 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:

#####
_####
__###
___##
____#

Content#