Alphabet

Letter F

With vector graphics lines and shapes can be drawn to any scale without losing quality because unlike photographs, the mathematics to draw the image is stored instead of the individual-coloured pixels. Vectors are also great for sending instructions to hardware such as laser cutters and embroidery machines.

Try


Select the button below to open the Python program in a new window. Run the program and read the lines of code to see if you can understand how it works. It will be helpful to arrange your display so that you can have this browser window on one side of the screen and the code on the other.

Note, in Trinket, the turtle library is only supported in Python v2, so there is no support for the match/case command.

Watch this video to learn about the new concepts shown in the program:

Knowledge Organiser

Command summary

The new commands used in this program and others that may be useful. Select them below to learn more:

turtle.left(x)

Turns the turtle left x degrees. Turns are always made from the perspective of the turtle, not the programmer, so if the turtle is facing down, left will be right and right will be left!

turtle.right(x)

Turns the turtle right x degrees. Turns are always made from the perspective of the turtle, not the programmer, so if the turtle is facing down, left will be right and right will be left!

turtle.forward(x)

Moves the turtle forward x pixels. If the pen is down (default) a line will be drawn from the start position to the end position. If the pen is up a line will not be drawn.

turtle.back(x)

Moves the turtle backwards pixels without turning around. If the pen is down (default) a line will be drawn from the start position to the end position. If the pen is up a line will not be drawn.

turtle.pensize(x)

Sets the pen to be x pixels wide. The default is 1. Larger numbers result in thicker lines being drawn.

turtle.done()

Ends the turtle program. This is not necessary, but some implementations of turtle require this to prevent the graphics canvas window being closed automatically when the program ends. It is good practice to include this command at the end of programs using turtle.

There are shortcuts and alternatives to many of the turtle commands, such as turtle.fd, turtle.bk, turtle.backward.

Investigate


Questions to think about with this program to check your understanding:

Item question

Identify an argument in the program.

REVEAL ANSWER

"C" is an argument in the command:

draw_letter("C")

Arguments are the data that is passed into subprograms where they become known as parameters.

Structure question

If a turtle is facing downwards, which direction would it be facing after the command turtle.left(90)?

REVEAL ANSWER

Turns are always seen from the perspective of the turtle. If the turtle is facing downwards, turning left(90) would make it face right.

Make


Success Criteria

Change the program below so that it:

  1. Includes another subprogram to output the letter "F".

Sample output from the program

Evaluate


Run your code to check that your program has met the success criteria and produces the required output.

Registered in England and Wales: 10442992

VAT Number: 290 9845 58

Telephone: 01452 947500

Email: admin@craigndave.co.uk

Craig'n'Dave logo

Craig 'n' Dave

Bett Awards 2024 Finalist