In our Assignment 1, our objective is to practise solving a problem by creating a whole Python program using what we have learnt so far:
1. Python building blocks,
2. Iterative statements, especially the for loops,
4. The software development process, and
5. The Python Turtle Graphics module along with its built-in
Before Doing This Assignment …
… I strongly recommend you do Lab – Functions and Turtle, posted on our course web tie.
In this Assignment 1, we are to write a Python program, called MonChefDoeuvre1194.py, which is to create a drawing inspired from a piece of art (painting, sculpture, etc…) created by a known artist using the Python Turtle Graphics module and its built-in functions. For example, this “chef d’oeuvre” (shown in class on Wed. June 12):
was inspired by Van Gogh’s famous painting Starry Night:
To give us an idea of the possible length of the program we are asked to write for Assignment 1, the program that created the drawing displayed above has about 300 lines of Python code statements.
This is to say that our chef d’oeuvre cannot be a bunch of shapes drawn together with no theme like the drawing created by the program Turtle Lab.py seen in our lab (Lab – Functions and Turtle) found on our course web site.
Our chef d’oeuvre (program) is to also satisfy the following requirements. Requirements:
1. We must use Python 3 (the Python IDLE version used in our CSIL lab) to write our program as opposed to Repl.It.
2. Our program is to execute as soon as one has pressed the F5 key or has selected the option Run -> Run Module from the Python IDLE menu. No user input is required in this assignment. This is to say that the user must not be prompted for any input data once our chef d’oeuvre Python program has started executing. It executes all on its own.
3. Letusmakesurethatourdrawingisnottoolargeandcanbeseeninits entirety in the window without having the user either resizing the window or making use of the scroll bars to view our drawing.
4. We cannot make use of Python modules that must first be downloaded on a computer before they can be used. We can only use Python modules that are already available on the computer (available by simply using the Python statement import in our Python program).
5. Our drawing must be composed of at least 30 shapes.
If we look at the drawing created by the program Turtle_Lab.py seen in our Lab – Functions and Turtle (see Link to Turtle_Lab.py on our course web site for TH June 13), we can count 9 shapes:
• 2 rectangles,
• 1 square,
• 3 circles,
• 2 semi circles (note that 2 semi circles drawn together count as 1 shape, but here, the 2 semi circles are not drawn together so they count as 2 shapes) and
• 1 quarter of a circle.
6. Our drawing must include at least 8 colours.
If we look at the drawing created by the program Turtle_Lab.py, we can count 8 colours.
If we look at the program Turtle_Lab.py, we can count 2 for loops.
8. Our program must include at least 6 functions:
4 of them must be void functions: functions that do not return any “value” (possibly doing drawings and/or pen movements, or creating more complex shapes),
• Note that these 4 functions may or may not require parameters.
5 of them must require parameters (the number of parameters is up to us).
• Note that these 5 functions may or may not be void.
If we look at the program Turtle_Lab.py, we can count 3 void functions that require parameters and 3 incomplete functions. Of course, we cannot submit a program with incomplete functions. J
9. We have designed our functions such that they are as general as they can be (principle of generalization). They are designed in such a way (with parameters and/or returned value) that they can solve several similar problems.
10.None of our code is repeated. This is to say that we encapsulated repeated code into functions and have called these functions whenever needed.
11. All our functions terminate with a return statement.
12. Since the drawing we create in this assignment is completely up to us (yet inspired by a known piece of art), no two drawings is expected to be similar!
Enjoy the creative process!
Suggestion: Implement and test our Python program in an incremental fashion, i.e., we implement a few features (perhaps shapes or functions) of our drawing,
test them, then we implement a few more, test them, etc., until the whole drawing is done.
This incremental software development strategy is in contrast with the “Big Bang” approach where the whole program in written in one go and only tested at the end. This approach often leads to lengthy debugging sessions. Not fun! L
After the due date, we shall have Art Gallery moments at the beginning of our classes in which we shall present chef d’oeuvres.
So, if we are proud of what we created in this assignment and wish to have it presented in class, please, let the instructor know by saying so on the very last line of our header.
本网站支持 Alipay WeChatPay PayPal等支付方式
E-mail: email@example.com 微信号:vipdue