Homework 1

Due Tuesday 31-Aug, at 10:00pm 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. 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 pixels. You need to draw the number "manually". You may not use functions like turtle.write to directly produce the text.

  2. 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. You need to draw the number "manually". You may not use functions like turtle.write to directly produce the text.

  3. 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. You need to draw the number "manually". You may not use functions like turtle.write to directly produce the text.

  4. 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. You need to draw the number "manually". You may not use functions like turtle.write to directly produce the text.

  5. 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. You need to draw the number "manually". You may not use functions like turtle.write to directly produce the text.

  6. drawClock() [20 pts]
    Use the draw numbers functions (call them) to create a clockface. Your function should be called drawClock. Your clock should have a radius of 100 pixels. Your output should be similar to the below:
    Image of a clock face drawn with the turtle library

  7. drawQatarFlag() [15 pts]
    Write a function called drawQatarFlag that draws the Qatari Flag as shown below. You might need to look up turtle library functions to figure out how to fill in shapes.

    The flag should be 200 pixels tall by 500 wide. Also, the colors you use for the flag must be correct. Do a little research on Wikipedia in order to determine exactly which color the flag really is...
    Image of a Qatar flag drawn with the turtle library

  8. drawClassroom() [15 pts]
    Using the functions you've written so far (call them), and a little bit of additional drawing, produce an image of a back to school scene in a classroom here in Qatar. It should include a clock, a flag, and a chalkboard with a special message on it. Your function should be called drawClassroom().
    For this function, you may use the turtle.write function to produce the text on the chalkboard. You output should be similar to the below:
    Image of a classroom drawn with the turtle library