Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Don\'t use \"import\" or \"input()\" in this problem. Q1) Write a Python functio

ID: 3778999 • Letter: D

Question

Don't use "import" or "input()" in this problem.
Q1) Write a Python function Pyramid0 which takes a positive int value as the formal parameter and returns no value. The value determines the number of rows of the pyramid. A pyramid has one star at the top and the number of stars increments by two on each subsequent row. (See the sample output in the starter code.) Use the starter code bellow to begin. def Pyramid (n): Your code goes here def test pyramid for i in range (5, 12, 3) Pyramid (i) print test pyramid For this problem, you can use either for loops or while loops. Do not modify the tes rt0 function. Spaces and stars must be printed one at a time. other rules and hints remain the same as above

Explanation / Answer

def Pyramid(n):
   l=n-1
   k=1
   for i in range(l,-1,-1):
       for j in range(0,i):
           print(" ",end="")
       for j in range(0,k):
           print("*",end="")
       for j in range(0,i):
           print(" ",end="")
       k+=2
       print("")
def test_pyramid():
   for i in range(5,12,3):
       Pyramid(i)
       print("")
test_pyramid()

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote