-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstaircase.py
More file actions
30 lines (24 loc) · 753 Bytes
/
staircase.py
File metadata and controls
30 lines (24 loc) · 753 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
"""
Drawing a staircase with strings
Author: Oğuzhan Çölkesen
"""
def draw_staircase():
"""Prints a staircase composed of `*' signs with user-specified dimensions.
Here's an example:
height = 5, width = 3
* * *
. . * * *
. . . . * * *
. . . . . . * * *
. . . . . . . . * * *
"""
height = int(input("Enter the height of the staircase: "))
width = int(input("Enter the width of the staircase: "))
for i in range (height):
for j in range (width):
for k in range (i * (width - 1)):
print (".", end = " ")
i = 0
# Setting i as 0 so that the loop only runs once inside the other loop.
print("*", end = " ")
print()