Question: Exercise 8: Program exercise for Function with parameters Write a complete Python program including minimal comments (file name, your name, and problem description) that solves

Exercise 8: Program exercise for Function with parameters

Write a complete Python program including minimal comments (file name, your name, and problem description) that solves the following problem with themainfunction:

Problem Specification:

Write a program that performs the following tasks:

Write a main function that reads one symbol, 2 integer and draws the figure similar to the following picture.

Your main function should call DrawRectangle and DrawTriangle functions to draws the figure below.

You should have a function drawBar(symbol, length) which use a loop to draw a horizontal bar of length with the symbol filled.

DrawRectangle function takes 3 arguments (symbol, width, and height) which calls DrawBar.

DrawTriangle function takes 2 arguments (symbol and height) which calls DrawBar. exercise. You can make this function with 3 arguments (symbol, height, and direction).

Sample Run #1

Sample Run #2

Enter the symbol for the shapes: X

Enter the width of the shape: 7

Enter the height of the shapes: 5

XXXXXXX

XXXXXXX

XXXXXXX

XXXXXXX

XXXXXXX

X

XX

XXX

XXXX

XXXXX

XXXX

XXX

XX

X

(followings are optional)

X

XXX

XXXXX

XXXXXXX

XXXXXXXXX

XXXXXXXXX

XXXXXXXXX

XXXXXXXXX

XXXXXXXXX

Enter the symbol for the shapes: #

Enter the width of the shape: 4

Enter the height of the shapes: 6

####

####

####

####

####

####

#

##

###

####

#####

######

#####

####

###

##

#

(followings are optional)

#

###

#####

#######

#########

###########

###########

###########

###########

###########

###########

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!