Write the following pattern program in Python:
Answers
Answer:
Table of Contents
Pattern #1: Simple Number Triangle Pattern
Pattern #2: Inverted Pyramid of Numbers
Pattern #3: Half Pyramid Pattern of Numbers
Pattern #4: Inverted Pyramid of Descending Numbers
Pattern #5: Inverted Pyramid of the Same Digit
Pattern #6: Reverse Pyramid of Numbers
Pattern #7: Inverted Half Pyramid Number Pattern
Pattern #8: Pyramid of Natural Numbers Less Than 10
Pattern #9: Reverse Pattern of Digits from 10
Pattern #10: Unique Pyramid Pattern of Digits
Pattern #11: Connected Inverted Pyramid Pattern of Numbers
Pattern #12: Even Number Pyramid Pattern
Pattern #13: Pyramid of Horizontal Tables
Pattern #14: Pyramid Pattern of Alternate Numbers
Pattern #15: Mirrored Pyramid (Right-angled Triangle) Pattern of Numbers
Pattern #16: Equilateral Triangle with Stars (Asterisk Symbol)
Pattern #17: Downward Triangle Pattern of Stars
Pattern #18: Pyramid Pattern of Stars
Explanation:
HOPE THIS ANSWER IS HELPFUL TO YOU...
Explanation:
In order to solve this problem, one must have the basic knowledge about columns and rows.
- Vertical divisions are called columns.
- Horizontal divisions are called rows.
Now, we can divide the given pattern into different columns and rows (see attachment 1). First attachment is self explanatory.
Using print function and if else statements, print the stars in required columns and rows.
Python cōde:
for row in range(4):
for col in range(7):
if (row==0 and col!=3) or (col==1 or col==5) or (row ==3 and col<3):
print("* ", end ="")
else:
print(end = " ")
print()
If indentations not viewing properly, kindly see the 2nd attachment.