Hello everyone! Welcome back to programminginpython.com. I am continuing with this pattern programming series, here I will tell you how to print the pattern of the letter A.
Also, I will try to display the patterns for all other alphabets later in this series.
You can also watch the video on YouTube here.
Task:
Python program to print the pattern of letter βAβ
Approach:
- Read an input integer for asking the sizeof the letter using
input()
- Check if the enter number is greater than 8,
- if yes, call the function `print_pattern()`
- else, show a message to enter number which is greater or equal to 8
- print_pattern()
- here we only do two things, print star(
*
) and print space(` `), just writing conditions so the pattern of*
βs and ` `βs will display the pattern βAβ - following are 3 conditions for printing *βs
We have 2 loops, outer loop() for rowβs and inner loop for columns. - every line β at the start and end
(j == 0 or j == n //2) and i != 0
- middle line β the whole line
i == n // 2
- first line β whole line except first and last row
i == 0 and j != 0 and j != n // 2
- print ` ` in remaining all cases.
- here we only do two things, print star(
Program:
Print Pattern A β Code Visualization
Output:

Thatβs it for this post guys, also feel free to check other programs on patterns here or find some programs on algorithms here.
Course Suggestion
Machine Learning is everywhere! So I strongly suggest you take the course below.
Course: Machine Learning Adv: Support Vector Machines (SVM) Python