Login
Remember
Register
Ask a Question
Write a program in Python to produce Star triangle?
0
votes
asked
May 17, 2020
in
Python
by
sharadyadav1986
Write a program in Python to produce Star triangle?
#python-star-triangle
Python-questions-answers
Please
log in
or
register
to answer this question.
1
Answer
0
votes
answered
May 17, 2020
by
Robindeniel
The code to produce star triangle is as follows:
1
2
3
4
def pyfun(r):
for a in range(r):
print(' '*(r-x-1)+'*'*(2*x+1))
pyfun(9)
Output:
1
2
3
4
5
6
7
8
9
*
***
*****
*******
*********
***********
*************
***************
*****************
...