Getting Started

Quick Reference

circle

The function circle draws a circle.

It takes three arguments, the x and y co-ordinates of the center and the diameter.

circle(200, 100, 50)

rect

The function rect draws a rectangle. It takes four arguments, the x and y co-ordinates of the top-left corner and width and height of the rectangle.

rect(200, 100, 50, 75);

Exercises

Write programs to draw the following patterns.

Problem 1.1

Three circles in a line

Three circles in a line.

Problem 1.2

Concentric Circles

Three concentric circles.

Problem 1.3

Touching Circles

Three circles touching at bottom.

Problem 1.4

Two small circles in a big circle

Two small circles in a big circle.

Problem 1.5

plus

Plus/cross pattern.

Problem 1.6

four corner squares

Four small squares touch the four corners of a big square.

Problem 1.7

circle in a square.

Circle in a square.

Problem 1.8

square in a circle.

Square in a circle.