0
how to print a staircase in python? like below ** **** ****** ********
8 Answers
+ 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 "*"
+ 1
rows = 8
for i in range(rows):
print("".join([str("*") for x in range(i)]))
+ 1
but I want in the form of
**
****
******
********
+ 1
put ("*"*2)
+ 1
got it thanq
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)
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
0
********