Home
Recent Q&A
Java
Cloud
JavaScript
Python
SQL
PHP
HTML
C++
Data Science
DBMS
Devops
Hadoop
Machine Learning
Azure
Blockchain
Devops
Ask a Question
Write a program in Python to produce Star triangle?
Home
Python
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
*
***
*****
*******
*********
***********
*************
***************
*****************
Your comment on this answer:
Email me at this address if a comment is added after mine:
Email me if a comment is added after mine
Privacy: Your email address will only be used for sending these notifications.
Related questions
0
votes
Q: Write a Java Program to display the left triangle star pattern on the system console.
asked
Jul 24, 2023
in
Design Patterns
by
SakshiSharma
lefttrianglestarpattern
+1
vote
Q: Write A Program in Python to Print the following pattern
asked
Feb 15, 2021
in
Python
by
SakshiSharma
#python-program
progam-python
python-pattern
Python-questions-answers
+1
vote
Q: Write a python program to check if the number given is a palindrome or not
asked
Feb 15, 2021
in
Python
by
SakshiSharma
#python-program
palindrome-program
python-palindrome
Python-questions-answers
+1
vote
Q: Write a python program to print the factorial of a number.
asked
Feb 15, 2021
in
Python
by
SakshiSharma
#python-factorial-number
factorial-number-function
factorial-program
python-program
Python-questions-answers
+1
vote
Q: Write a program to display the Fibonacci sequence in Python?
asked
May 17, 2020
in
Python
by
sharadyadav1986
#python-fibonacci-sequence
Python-questions-answers
0
votes
Q: Write a program in Python for getting indices of N maximum values in a NumPy array.
asked
Oct 12, 2021
in
Python
by
rajeshsharma
n-maximum-value
numpy-array
Python-questions-answers
+2
votes
Q: Write a program to print out the 2-table using while loop.
asked
Feb 15, 2021
in
Python
by
SakshiSharma
#python-table
table
table-loop
while-loop
Python-questions-answers
0
votes
Q: Write a program to check whether the given number is prime or not?
asked
May 17, 2020
in
Python
by
sharadyadav1986
#python-prime-number-program
Python-questions-answers
0
votes
Q: Write a program to count the number of capital letters in a file?
asked
May 17, 2020
in
Python
by
sharadyadav1986
#python-program-counter
Python-questions-answers
0
votes
Q: What Is The Command To Debug A Python Program?
asked
Dec 22, 2019
in
Python
by
rajeshsharma
#python-debug
Python-questions-answers
...