Question: The picture is the example. There are two Python files you need to create for first part. One is a python file that contains the
The picture is the example.
There are two Python files you need to create for first part. One is a python file that contains the code for your function. This is the one you will be sharing. Well look at an example in a moment. The other file is a python sketch that tests your function by calling it and showing the result. The idea is that you need to test your code before you post it This is a basic principle of software engineering.
Python Turtle Graphics Part one deliverables
You need to code two Python files, modeled on but not exactly copying the examples here.
a file like jrdrawcircle.py that contains a function that we can call to draw somethings in the Display window. Which things whatever you like, shapes, text, pictures, etc. The key requirement is that your function must take parameters:
a color number,
an X coordinate an
a Y coordinate
in that order.
Your function must return a tuple containing
a new color number,
a new X coordinate and
a new y coordinate.
In that order.
To get a new X or a new Y or a new color, perform some math operation on the corresponding input parameter value, or add or subtract a random value, taking care not to go outside the range of to on color, and to keep within the size of the Display window for X and Y and in this example
This is the file you will post in the Discussion forum AFTER you test it
It will be very helpful if you name your function starting with your name or initials, and adding on some words that hint at what it does.
To test your function, code a sketch modeled on sketchmyfunction that runs your function and shows that it works. Don't post this code, but keep it handy for testing and submission.
Part two deliverables
When we get to part two next week, you'll choose some functions from those posted and combine them in your test code to get a hopefully interesting composite output, which you can then post.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
