Question: Your first task is to create your own version of the program moredrawing.py that we discussed in Lecture 8 . The file for this program

Your first task is to create your own version of the program
moredrawing.py that we discussed in Lecture 8. The file for
this program is posted on Canvas. Use the posted file to cre-
ate a new program file. The only change you need to make is in
main(): alter the parameter choices in the calls to drawsquare()
so that the squares are different than the ones I showed in
the lecture. When youre finished, run the program and post
screenshots of your work.
2. The function drawsquare in the program moredrawing.py only
draws squares whose sides are parallel to the sides of the screen.
I want you to change this! We can draw tilted squares by turn-
ing the turtle so that its pointing at an angle to the horizontal.
Then you can have the turtle carry out the commands that
draw the square.
To make this change to the function, do the following:
(a) Add a new parameter called tiltangle to the parameter list.
This will be an angle measured in degrees.
(b) Add a command near the beginning that turns the turtle
left using tiltangle as the number of degrees.
(c) Leave the rest of the function as is.
After updating drawsquare(), test it by adding an angle value
to the argument list each time drawsquare is called in main().
Use a diffferent tilt angle each time the function is called. When
youre finished, post screenshots of the program and the output.
3. Now add a new function called drawequilateral() to your
program. This function should draw equilateral triangles where
one side (the base) is a horizontal line segment. The side length,
the fill color, and the location of the lower left corner should be
given as parameters. The function should end by sending the
turtle home and turning it so that its forward direction is hori-
zontal. When the function is complete, add at least three calls
to the function in main(). If your screen is getting cluttered
1
with shapes, remove the calls to function drawsquare() before
adding the calls to drawequilateral(). When the program is
working, post screenshots of the program and the output.
4. It would be nice to have more flexibility in how the triangles
are oriented. Update the function drawequilateral() so that
the base of the triangle is not necessarily horizontal. Do this by
adding a parameter called tiltangle to the parameter list. Then
turn the turtle left using tiltangle as the number of degrees
before executing the commands that draw the triangle. The
function should end by sending the turtle home and turning it
so that its forward direction is horizontal. When the function
is complete, put at least three calls to the function in main().
When the program is working, post screenshots of the program
and the output.
5. Your program moredrawing.py now contains functions that
can be used as tools in producing an image. Write a program
that uses squares, triangles, and circles to create some sort of
pattern in the turtle screen. The pattern should be produced
using strategic calls to drawsquare amd drawequilateral along
with methods already available to turtles.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!