(CODE MUST BE WRITTEN IN PYTHON) (NO 'END' PARAMETER AND NO FUNCTIONS), please read carefully This exercise asks you to draw the following target composed of concentric rectangles (view inserted image) A target is composed of n rectangles centered on the middle of the target. These rectangles are of dimensions 3x3, 7x7, 11x11 and so on. The largest rectangle is composed of characters "1", the second largest of characters "2", and so on. All other characters are spaces. The character in the center of the target is always a space, and the characters around the target are always "1". You should draw a target consisting of 3 rectangles by printing it in the console. However, it should be easy to change the number of rectangles, so that you can draw a different target. You can assume, however, that the number of rectangles requested will always be between 1 and 9 inclusive, since the rectangles must be composed of the numbers 1 to 9. The target must be drawn in a single call to print. You will need to generate the text for the target and then print it at the end of the program. To do this, you must use loops. Note that this will require you to generate text that contains line breaks to separate the rows in your design. However, there must be no line breaks at the end of the design, after the last row of the target. You may not use the multiplication operator on strings. You are also not allowed to use function definitions and must not use the end parameter.  Hint: a trick to drawing this target is to use the maximum norm. The distance between two points (x1, y1) and (x2, y2) defined by the maximum norm is equal to max(abs(x1 - x2), abs(y1 - y2)). Note that a character in the drawing is a digit if and only if its distance defined by the maximum norm from the center is odd, otherwise the character is a space.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

(CODE MUST BE WRITTEN IN PYTHON) (NO 'END' PARAMETER AND NO FUNCTIONS), please read carefully

This exercise asks you to draw the following target composed of concentric rectangles

(view inserted image)

A target is composed of n rectangles centered on the middle of the target. These rectangles are of dimensions 3x3, 7x7, 11x11 and so on. The largest rectangle is composed of characters "1", the second largest of characters "2", and so on. All other characters are spaces. The character in the center of the target is always a space, and the characters around the target are always "1".

You should draw a target consisting of 3 rectangles by printing it in the console. However, it should be easy to change the number of rectangles, so that you can draw a different target. You can assume, however, that the number of rectangles requested will always be between 1 and 9 inclusive, since the rectangles must be composed of the numbers 1 to 9.

The target must be drawn in a single call to print. You will need to generate the text for the target and then print it at the end of the program. To do this, you must use loops. Note that this will require you to generate text that contains line breaks to separate the rows in your design. However, there must be no line breaks at the end of the design, after the last row of the target.

You may not use the multiplication operator on strings. You are also not allowed to use function definitions and must not use the end parameter. 

Hint: a trick to drawing this target is to use the maximum norm. The distance between two points (x1, y1) and (x2, y2) defined by the maximum norm is equal to max(abs(x1 - x2), abs(y1 - y2)). Note that a character in the drawing is a digit if and only if its distance defined by the maximum norm from the center is odd, otherwise the character is a space.

11111111111
1
1
1 2222222 1
1 2
1 2 333 2 1
1 2 332 1
1 2 333 2 1
1 2
1 2222222 1
2 1
2 1
1
11111111111
Transcribed Image Text:11111111111 1 1 1 2222222 1 1 2 1 2 333 2 1 1 2 332 1 1 2 333 2 1 1 2 1 2222222 1 2 1 2 1 1 11111111111
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY