Question: both method fail to pass the test, please help Write a program to print a diamond made up of left- and right- aligned right-angled isosceles


Write a program to print a diamond made up of left- and right- aligned right-angled isosceles triangles, all of positive integer height specified by the user's keyboard input, as follows: Enter triangle height: 6 **** **** *** *** ** ** * *** *** **** **** ***** III 1 height = int(input("Enter triangle height: ")) 2 space = 0 3 star = height 4 pattern 5 for i in range (height): 6 pattern+="*"*star+" "*space+"*"*star+" " 7 space = space+2 8 star = star 1 I 9 star = star + 2 10 space = space 4 11 for i in range (height-1): 12 pattern+="*"*star+" "*space+"***star+" " 13 space = space-2 14 star = star+1 6 1 def printTriangle(n): 2 for i in range(n): 3 for j in range(in) : 4 print("*', end='') 5 for k in range (2*1): 6 print(' ', end='') 7 for l in range(i,n): 8 print("*', end='') 9 print() 1 10 for i in range(1,n): 11 for j in range (i+1): 12 print("*', end='') 13 for k in range (2*1,2*n-2): nrint 1 and=!!) Submissions Output 8 14 ** ** *** *** **** One or more input prompts are not correct
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
