+ 1
Triangle of stars
Hi I’m stuck with this question please help me : This code tries to make a triangle out of stars. But oh no! There’s an error in there somewhere - it outputs all the stars on one line, instead of separate lines. Fix the code to output a triangle of stars that has 4 rows. https://code.sololearn.com/cqnZdycFwOmt/?ref=app
7 ответов
+ 3
You need to remove the extra "\n" to avoid it.
print("*\n**\n***\n****")
+ 4
for x in range(15):
print(' '*(15-x)+'*'*x+'*'*x+'*')
https://code.sololearn.com/cuiP99YX3cKW/?ref=app
+ 2
x = 5
for i in range(1, x+1):
print("*"*i)
+ 1
print("*\n**\n***\n****\n")
+ 1
you can try this code below
print("""*
**
***
****""")
0
Thx!
0
print("*\n**\n***\n****\n")