We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
**To solve this problem and print a staircase of size
using # symbols and spaces, you can create a function in Python like the one below:
defstaircase(n):foriinrange(1,n+1):print(' '*(n-i)+'#'*i)# Input the size of the staircasen=int(input("Enter the size of the staircase: "))staircase(n)
This function staircase(n) takes an integer
as input and prints a staircase of size
as described in the problem statement. It uses a loop to iterate from 1 to
and prints the appropriate number of spaces and # symbols for each row of the staircase.
You can run this program by providing an integer input for the size of the staircase, and it will output the staircase pattern accordingly.**
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Staircase
You are viewing a single comment's thread. Return to all comments →
**To solve this problem and print a staircase of size
This function
staircase(n)
takes an integerYou can run this program by providing an integer input for the size of the staircase, and it will output the staircase pattern accordingly.**