π’ Lab 1β£.1β£...with Python!
December 08, 2016Geometric Fun Timesβ’
In this lab, you will write a Python program to draw some simple shapes on the stage.
1. Drawing a square
Ask the user for the shape they would like:
shape = input("What shape would you like")
1.1) Using Turtle, if the user says square
, the computer should draw a square.
1.2) Add code so that the sprite says the word βsquareβ while it is drawing.
Comment your code explaining your work.
2. Adding more shapes
2.1) Now that youβve drawn a square, add code to draw the shapes in the following table. The user should be able to say the name of the shape and see it appear.
- Square
- Equilateral triangle
- Diamond
- Pentagon
- Parallelogram (βleaning rectangleβ)
- Star
You will probably want to draw a sketch of each to figure out the angles in each shape.
2.2) Add code so that as each shape is being drawn, the sprite is saying the name of shape.
2.3) Modify your code so that each different shape is drawn in a different color and with a different line thickness. So, for example, if the square is drawn in blue with a line thickness of 3, each other shape must be drawn in a color that is not blue and with a line thickness that is not 3. You may choose whatever colors your want.
2.4) Add code so that the sprite is hidden when it is not drawing. This is will make sure that the sprite is not obstructing the view of your beautiful artwork!
3) Comment your code! What did you do? Where did you get stuck? How did you fix it?