Homework 1

Due Tuesday 26-Jan, at 8pm on Gradescope.


To start

  1. Create a folder named ‘hw1’
  2. Create a file name hw1.py
  3. Edit hw1.py and add the functions as required
  4. When you have completed and fully tested hw1, submit hw1.py to Gradescope. For this hw, you may submit as many times as you want up until the deadline, but only your last submission counts.

Some important notes

  1. This homework is solo. You may not collaborate or discuss it with anyone outside of the course, and your options for discussing with other students currently taking the course are limited. See the academic honesty policy for more details.
  2. After you submit to Gradescope, make sure you check the output. It should tell you that it was able to find all of the functions.
  3. Remember the course’s academic integrity policy. Solving the homework yourself is your best preparation for exams and quizzes; cheating or short-cutting your learning process in order to improve your homework score will actually hurt your course grade long-term.

Problems

  1. drawRect(length, height) [5 pts]
    Write a function called drawRect that takes two input parameters: the length and height of a rectangle. The function should then use the turtle commands to create a rectangle with the dimensions according to the values passed in.

  2. drawOne() [10 pts]
    Write a function called drawOne that uses the turtle library to draw the number 1. The pensize should be 3 and the height of the digit should be 24 units.

  3. drawTwo() [10 pts]
    Write a function called drawTwo that uses the turtle library to draw the number 2. The pensize should be 3 and the height of the digit should be 24 units.

  4. drawThree() [10 pts]
    Write a function called drawThree that uses the turtle library to draw the number 3. The pensize should be 3 and the height of the digit should be 24 units.

  5. drawSix() [10 pts]
    Write a function called drawSix that uses the turtle library to draw the number 6. The pensize should be 3 and the height of the digit should be 24 units.

  6. drawNine() [10 pts]
    Write a function called drawNine that uses the turtle library to draw the number 9. The pensize should be 3 and the height of the digit should be 24 units.

  7. drawClock() [20 pts]
    Use the draw numbers functions to create a clockface. Your function should be called drawClock. You output should be similar to the below:
    Image of a clock face drawn with the turtle library

  8. drawClockTower() [25 pts]
    Write a function called drawClockTower that uses the functions you've written so far to draw a clock tower as shown below:
    Image of a clock tower drawn with the turtle library