Question
Design and implement a single program: to produce a simple graphical representation of a set of regular pentagons, as shown in Figure 1 (below). The
Design and implement a single program: to produce a simple graphical representation of a set of regular pentagons, as shown in Figure 1 (below). The output should consist of 4 pentagons with sides of length 20, 40, 60 and 80 respectively, nested as shown. A regular pentagon has 5 sides and the inner angle of a regular pentagon is 72 degrees. The distance between any two successive pentagons should be the same: there should be 10 units (measured as a straight line) vertically between the bottom left corners of successive pentagons; there should be 10 units measured horizontally between the bottom left corners of successive pentagons (see Figure 2) that, in principle, can produce larger numbers of pentagons simply by changing one number that specifies the number of pentagons with the turtle starting at the position that we want to be the bottom left hand corner of the innermost pentagon and the turtle pointing to the right a.produce a top-level decomposition, making use of exactly one loop. At this stage express your answer in terms of two sub-problems. (4 marks) b.Refine your decomposition to give an algorithm, as you include extra detail make use of a second loop. (8 marks) c.Translate your algorithm into Python, including appropriate comments, and run your program to ensure the output matches Figure 1. You do not need to submit an output. Name your Python file Q2_OUCU.py, where OUCU is your OU computer username, e.g. abc123. Write your code in this file. Then include the code file in your TMA zip file. Paste your completed Python code into your solution document as text and state whether it is successful in producing the required output. Your answer must be a translation of your algorithm from (b), otherwise no marks will be awarded. Use techniques and language features that are covered in the module. If you decide to use techniques or language features not covered in module, you must give a justification for this, or no marks will be given. (13 marks) Figure 1 Pentagons graphic Figure 2 Distances between lower left corners of pentagons
Figure 1 Pentagons graphic
Figure 2 Distances between lower left corners of pentagons
Python Turtle Graphics 10 10 Python Turtle Graphics 10 10Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started