0% found this document useful (0 votes)
0 views8 pages

Star Patterns in Python

The document provides Python code examples for creating various star patterns, including right-angled triangles, left-angled triangles, pyramids, inverted pyramids, and diamond shapes. Each pattern is accompanied by the corresponding code and output illustrations. Additionally, it promotes a YouTube and Telegram channel for further resources and materials.

Uploaded by

kavitaypgtcs
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views8 pages

Star Patterns in Python

The document provides Python code examples for creating various star patterns, including right-angled triangles, left-angled triangles, pyramids, inverted pyramids, and diamond shapes. Each pattern is accompanied by the corresponding code and output illustrations. Additionally, it promotes a YouTube and Telegram channel for further resources and materials.

Uploaded by

kavitaypgtcs
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Python In Hindi 27

Star Patterns *
***
*****
*******
* * * ********* *********
** ** *** ******* *******
*** *** ***** ***** *****
**** **** ******* *** ***
***** ***** ********* * *
The CS Pundit
Right Angled Triangle
for i in range(5): Output :
for j in range(i+1): *
**
print('*', end='')
***
print() ****
*****

Youtube Channel : @TheCSPundit


https://youtu.be/3Mwv_tUp6WQ
Telegram Channel : @TheCSPundit
Left Angled Triangle
* Left Angled Right Angled

* *
* *
** **
* * * *** ***
**** ****
* * * *
***** *****
* * * * *
Left Angled Triangle
for i in range(5): Output :
for k in range(4-i): *
print(' ',end='') **
***
for j in range(i+1):
****
print('*', end='') *****
print()
Pyramid Shape
for i in range(5): Output :

for k in range(4-i): *
***
print(' ',end='') *****
for j in range(i+1+i): *******
print('*', end='') *********
print()
Inverted Pyramid Shape
for i in range(4,-1,-1): Output :

for k in range(4-i): *********


*******
print(' ',end='') *****
for j in range(i+1+i): ***
print('*', end='') *
print()
for i in range(5): Diamond Shape
for k in range(4-i): Output :
print(' ',end='')
for j in range(i+1+i):
*
print('*', end='') ***
print() *****
for i in range(3,-1,-1): *******
for k in range(4-i): *********
print(' ',end='') *******
for j in range(i+1+i): *****
print('*', end='') ***
print() *
Thank You

Join Telegram Channel For Free PDFs & PPTs


Telegram Channel : https://t.me/TheCSPundit

You might also like