Skip to main content

Welcome to Coding 4 Programming

Addition of Two Binary Numbers | Function | Python

Star Patterns (Four Types) | Pyramid Star Pattern | Reverse Pyramid Star | Python

Python Program of Four Types of Star Patterns, Simple Star Pattern, Reverse Simple Star Pattern, Pyramid Star Pattern and Reverse Pyramid Star Pattern, through For Loop.

  • Coding for the above Program.

    1. n=int(input("Enter Number of Rows="))

    2. print("Simple Star Pattern:")
    3. for i in range(n):
    4.     print("*" * (i+1))

    5. print("Reverse Simple Star Pattern:")
    6. for i in range(n):
    7.     print("*" * (n-i))

    8. print("Pyramid Star Pattern")
    9. for i in range(n):
    10.     print(" " * (n-i-1), end="")
    11.     print("*" * (2*i+1), end="")
    12.     print(" " * (n-i-1))

    13. print("Reverse Pyramid Star Pattern")
    14. for i in range(n-1,-1, -1):
    15.     print(" " * (n-i-1), end="")
    16.     print("*" * (2*i+1), end="")
    17.     print(" " * (n-i-1))

  • Visual Studio Screenshot with Output of above Program

Star Patterns Program
Star Patterns Coding

Notes:

  • If you have any problem related to this program. Please do comment your Problem or Mail us.
  • For illustrating the any concept you can comment by line number.
  • Thank you! For more programs do regular visit to Coding 4 Programming.

Comments

Popular Posts