python code to print pyramid?
Answers
Answered by
1
size = 10
m = (2 * size) - 2
for i in range(0, size):
for j in range(0, m):
print(end=" ")
m = m - 1
for j in range(0, i + 1):
print("* ", end=' ')
print(" ")
Answered by
0
Answer:
The algorithm to print the pattern using for loop in Python:
1.Accept the number rows user want to print in the pattern.
2.Iterate those number using outer for loop to handle the number of rows.
3.Inner loop to handle the number of columns.
4.Print start, number, asterisk, Pyramid and diamond pattern using the print() function.
Similar questions
World Languages,
5 months ago
English,
5 months ago
English,
10 months ago
Social Sciences,
10 months ago
Biology,
1 year ago
Chemistry,
1 year ago
Chemistry,
1 year ago