Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question 2 ( 2 5 marks ) This question tests your understanding of Block 1 Part 2 . A frieze is a decorative pattern made
Question marks
This question tests your understanding of Block Part
A frieze is a decorative pattern made from repeated copies of a basic element arranged in a line. Figure shows part of a vertical frieze on the wall of a house.
Figure Example frieze
aProvide a toplevel decomposition of the problem of drawing a frieze, assuming for the moment that the basic element is repeated just times.
At this stage you are not trying to produce a solution; just break the problem itself down into smaller parts. We are looking for a birds eye view that could apply to a frieze composed of any basic element, and for now you should just assume that the exact form of the basic element will be considered later, so you can just say draw basic element for that step.
Your initial decomposition should use exactly one loop.
marks
In the remainder of this question, you will design and implement a program to draw the simpler frieze shown in Figure
Figure The frieze to be drawn for this question
In this frieze the basic element is a square tilted at degrees to the horizontal. The sides of the square are units long and each copy of the basic element is shifted upward by units relative to the previous copy Figure
Figure Dimensions of the frieze
bNext refine your decomposition, adding more detail so that it becomes an algorithm. This is not yet a program, so you should write the steps in English rather than as Python statements. To draw the basic element of the frieze you will need to use a second loop.
marks
cTranslate your algorithm into Python, including appropriate comments. Name your Python file QOUCUcpy where OUCU is your OU computer username, eg abc Run your program to test that it produces an output corresponding to Figure
Paste your Python code into your solution document as text, using an evenly spaced font such as Courier New or Consolas, and state whether it produced the expected output.
Also include the code file in your TMA zip file.
Your answer must be a translation of your algorithm from b otherwise marks will be deducted.
Here and in Part d below you should use only techniques and language features taught in TM If you decide to use techniques or language features not covered in the module, you must give a justification for this, or marks will be lost.
marks
dSave the code file again, this time as QOUCUdpy In part c your code always produces repetitions of the basic element. Now modify your code so that the required number of repetitions is held in a variable numberofelements, where numberofelements is initialised to in this case but can be initialised to a different value as required.
Run your program using different values of numberofelements to test that it produces the expected output.
Paste your Python code into your solution document as text, using an evenly spaced font such as Courier New or Consolas, and state whether it produced the expected output when you ran it
Also include the code file in your TMA zip file.
marks
Total marks
Step 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