0

how to print a staircase in python? like below ** **** ****** ********

13th Aug 2016, 1:57 AM
AKHILESH VVN
AKHILESH VVN - avatar
8 odpowiedzi
+ 2
row=4 for i in range(row): print("*"*int((i+1)*2)) ---Explaination-- range(4) = [0,1,2,3] Iterate between 0-3 First case : (0+1)*2 times printing "*" Second case : (1+1)*2 times printing "*" Third case : (2+1)*2 times printing "*" Fourth case : (3+1)*2 times printing "*"
13th Aug 2016, 3:17 AM
Prashant Shahi
Prashant Shahi - avatar
+ 1
rows = 8 for i in range(rows): print("".join([str("*") for x in range(i)]))
13th Aug 2016, 2:42 AM
Shekhar Nadar
Shekhar Nadar - avatar
+ 1
but I want in the form of ** **** ****** ********
13th Aug 2016, 2:47 AM
AKHILESH VVN
AKHILESH VVN - avatar
+ 1
put ("*"*2)
13th Aug 2016, 2:49 AM
Shekhar Nadar
Shekhar Nadar - avatar
+ 1
got it thanq
13th Aug 2016, 2:51 AM
AKHILESH VVN
AKHILESH VVN - avatar
0
you can do so inicio = int(input("Tell me are a number: ")) final = int(input("Tell me another number: ")) for i in range(inicio,final + 1): print("*" * i)
13th Aug 2016, 3:26 AM
Smithers and more
Smithers and more - avatar
0
Remember all these answers aren't the only way to do so! once you get better you'll figure out many other ways to accomplish your goals
16th Aug 2016, 1:00 AM
Eric Reed
Eric Reed - avatar
0
********
15th Nov 2020, 8:52 AM
peachezly Delicious
peachezly Delicious - avatar