Why I am unable to print Right triangle using "*"? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why I am unable to print Right triangle using "*"?

""" Print * in hallow right triangle shape * * * * * * * * * * * * """ n=int(input("Enter the no. of rows : ")) for row in range(0,n): for col in range(0,n): if row==0 or col==(n-1) or row==col: print("*", end=" ") else: print(end=" ") print() """When I am running this code it will not printing the right triangle correctly. First 5 star printed first after the input value taking in same line and then rest of the stars printed from second line. This issue happened in only Solo Learn App """

22nd Apr 2019, 10:36 PM
Mukesh Dhisale
2 Answers
22nd Apr 2019, 10:57 PM
Bilal Ahmed
Bilal Ahmed - avatar
+ 1
else: print(end=" ") # Double space
22nd Apr 2019, 11:26 PM
Diego
Diego - avatar