Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 1 Draw a letter 20 marks) a) For this question, you will build three helper functions and one main function. All four fine work

image text in transcribed

Question 1 Draw a letter 20 marks) a) For this question, you will build three helper functions and one main function. All four fine work together to draw the letter '11'. As you write your c am, test cech Function individually by calling it with dirorent function calls. Only move on to the next function une you meet that your current function work. Remember every line of code w e should be inside of a function. Here are the criteria . Your program "LSQlinitials.py" must seen with a commented U Box AND include A comment that indicates the purpose of the program. FACIT of the three beleer functions as well as the main function must sale its purposes comments Here are the sction specifications: 1) Helper function: draw etges The first helper function has been provided for you. Copy it into your program EXACTLY as written. The screenshot provide shows one function call using this function. Try calling it with other function calls so you are sure how it works. Purpose: Draw ona 'symbol' on either edge of the line leaving (width-21 spaces between the symbols >>> draw edges('s', 7) dof draw_edges (symbol, width: print (symbol + " "* (width-2) + symbol) >>>print('s'. ) 2) Telper function: draw_H (must call draw_edges) draw_ (symbol, width, height: After drawing a blank line, this function will produce a letter 'H' drawn with the symbol provided using the width and height giver. This function must call draw_edges at least once to help draw the letter 'H'. Refer to the screenshots to see some examples. Test it on other function calls as well. Note that the function's output begins with a black line. 3, 5) >>> dre H('+', 5, 7) >>> drew MC''. 3) Telper function: get width get_width : This function will prompt the user for an odd integer 3 or greater and error check the input to ensure it is valid. Return the valid user input. Refer to the screcushot for details. >>> width-get_width() Enter an odd number ) or greater: 1 --> Error! Try agains 6 --> Frror! Try again: 5 >>>print(width) 1 Matn function: draw letter (must call get width and draw ) draw_letter (syirbol): The main function must call get width to obtain the width, calculateletier height (width-2), and then rust call draw It appropriately to draw the 'H' with the information given. This function should not luve any print statements at all. . The sample output provided shows you two sample runs. Your output should be similar but reflect the symbol and wrdih provided. > drew letter ) Enter an odd number ) or greater: 3 >>draw_letter(+) Enter an odd number ) or greater: 1 ..) Error! Try again: 4 -- Error! Try again: 5 b) Save your program as "L5Qlinitials py" replacing initials with your actual initials. c) Submit your program electronically for marking (unless otherwise instructed)

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

Advances In Spatial Databases 2nd Symposium Ssd 91 Zurich Switzerland August 1991 Proceedings Lncs 525

Authors: Oliver Gunther ,Hans-Jorg Schek

1st Edition

3540544143, 978-3540544142

More Books

Students also viewed these Databases questions