Story Of Pattern

#pattern #printing #python

Swati Pandey Apr 28 2021 · 1 min read
Share this

Hello Everyone Once Again!

Once Upon a time there lived so many Patterns....................some were tricky while....

Pattern Printing in Python-Part1

Pattern printing is one of the most popular practices in any programming language. Since each programming language comes with its own Syntax howsoever the same logic can be implemented in almost all languages. Don’t confuse with the fact that for any pattern there could be many different ways to print the same pattern.

BASIC IDEA BEHIND ANY PATTERN PRINTING:

Step1: The very first outer loop will decide the number of rows in the pattern

Step2: The inner loop/loops will decide what needs to be printed and print statement will decide the manner in which pattern needs to be printed, i.e. triangular pattern, inverted triangular pattern etc.

Print statement is the HERO of Pattern Printing. Let us play with Print statement.

Types of Pattern:

(i). Basic Pattern: In this type of pattern printing special characters like “*”, “&” , “#”, etc.  or same number, symbols or alphabets are used.

                                       Pattern-1- Desired Output and Code Structure:

Basic Pattern

                                    Pattern-2- Desired Output and Code Structure:

Basic Pattern

                                    Pattern-3- Desired Output and Code Structure:

Basic Pattern

(ii). Series Pattern:

                                    Pattern-4- Desired Output and Code Structure:

Series Pattern

                                    Pattern-5- Desired Output and Code Structure:

Series Pattern

                                    Pattern-6- Desired Output and Code Structure:

Series Pattern

Note:

: Play with keyword argument “end” of print function

There is no as such categories like Basic/Series, it is for easy understanding.

Hope the concept behind creating patterns is clear and Please let me know if there is any mistake in the article.

Thank You

Comments
Read next