Computer Science, asked by meli44, 10 months ago

python code to print pyramid?

Answers

Answered by MasterPro
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 Stalin500
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
Physics, 5 months ago