Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

both method fail to pass the test, please help image text in transcribed
image text in transcribed
image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Visual Basic6 Database Programming

Authors: John W. Fronckowiak, David J. Helda

1st Edition

0764532545, 978-0764532542

More Books

Students also viewed these Databases questions