Python Programming

Star Pyramid

Python code for star pyramid using string repetition and for loop

8/10/2021
0 views
star-pyramid.pyPython
#!/usr/bin/evn python

for i in range(1,6):
    # String repetition using '*'
    print (' '*(5-i),'*'*(i*2))



#***** Output *****
#     **
#    ****
#   ******
#  ********
# **********
Pythonpython programmingstar pyramidstring repetitionfor loop

Loading comments...

Related Examples

Deliver breaking news, insightful commentary, and exclusive reports.

Targeting readers who rely on our platform to stay ahead of the curve.

Contact Us: benzingaheadlines@gmail.com