Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions square.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#python code to print stairs based on the input

#function
def print_staircase(n):
for i in range(1, n + 1):
stars = '*' * i
print(stars)

#input with cheeking
n = int(input("Enter the number of rows for the staircase: "))
if n > 0:
print_staircase(n)
else:
print("Please enter a positive integer.")