Created
September 4, 2019 05:10
-
-
Save atul-chaudhary/6f24cb1ca55b5ffbf729c8636927b7e5 to your computer and use it in GitHub Desktop.
HOTS: pattern program
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enter the height=3 | |
enter the width=3 | |
enter the number of stairs=3 | |
@@@ @@@ | |
@@ @@ | |
@ @ | |
@@@ @@@ | |
@@ @@ | |
@ @ | |
@@@ @@@ | |
@@ @@ | |
@ @ | |
enter the height=4 | |
enter the width=4 | |
enter the number of stairs=4 | |
@@@@ @@@@ | |
@@@ @@@ | |
@@ @@ | |
@ @ | |
@@@@ @@@@ | |
@@@ @@@ | |
@@ @@ | |
@ @ | |
@@@@ @@@@ | |
@@@ @@@ | |
@@ @@ | |
@ @ | |
@@@@ @@@@ | |
@@@ @@@ | |
@@ @@ | |
@ @ | |
#here is the program | |
h=int(input('enter the height=')) | |
w=int(input('enter the width=')) | |
t=int(input('enter the number of stairs=')) | |
s=w*(t-1) | |
sy=w | |
def func(w,s1,s2): | |
for i in range(w,0,-1): | |
for _ in range(s1): | |
print(end=' ') | |
for j in range(i): | |
print('@',end='') | |
for _ in range(s2): | |
print(end=' ') | |
s2 += 2 | |
for j in range(i): | |
print('@', end='') | |
print() | |
for i in range(1,t+1): | |
func(w,s,sy) | |
s-=w | |
sy+=w+w |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment