Indigeneous pre-program 2023 Exercises

Exercise 1:

Write a program to draw a triangle whose vertices are at (0,0), (1,0) and (0.2,0.5). A requirement is that you must use Python variables to specify the values of the vertices and use the variables in the drawing functions.

The end product should look like the picture below.



Exercise 2:

Write a program to draw a rectangle with a width of 2 and a height of 5. A requirement is that you must specify two variables called width and height, whose values are respectively 2 and 5. You must use these two variables in the program.

The end product should look like the picture below.


 

 

Exercise 3

Write a program to create the picture below.


Exercise 4

You have been introduced to the functions draw.move() and draw.turn(). Write a program which uses these two functions to create the square in the figure below.


 

 

Exercise 5

This exercise is similar to Exercise 4 except that you are asked to write a program to create the regular hexagon (with width 2) below.


Exercise 6

Now you have been introduced the for-loop. In this exercise, you are asked to write a program by using for, draw.move() and draw.turn() to create the regular hexagon as in Exercise 5.


Exercise 7 (Challenge)

Given an integer n which is 3 or greater, you are asked to write a program which will create a regular polygon with n sides. Your program needs to work with any valid value of n.