Knowing about ASCII character encoding is essential knowledge for Computer Science. It is basically a set of values which represent text characters, enabling the transmission of messages via electronic media.

Character Sets Slide Show

If you want to master character sets for GCSE Computer Science, check out this complete lesson with presentation, ASCII table, practice activities and Python code.

A great way to get motivated to learn about ASCII is ASCII art. Some of you may have seen ASCII art before – it’s graphics made up from ASCII characters, and was very popular in the early days of home computing when the graphics capabilities of the available machines were quite limited. There are some great examples on this website.

You can find a great tool to convert text into ASCII art in lots of different styles here. To make ASCII art from images, try this website.

Python and the ASCII Character Set

In terms of Python programming for Computer Science Exams, the most useful functions for learning about and working with ASCII are ord() and chr().

for example, run the following code in you chosen python coding environment

print(ord('A')) # prints the ASCII code for the character 'A'

Try a few other characters of your own.

Now something a bit more adventurous:

for char in 'Hello world':
    print(ord(char)) # Print the ASCII value for each character in turn

For the other direction, ASCII to text, we use chr(). E.g:

print(chr(65)) # Print character for ASCII code 65

As an exercise, use an ASCII table to predict what these numbers will produce:

80 121 116 104 111 110

Hopefully you now have a greater understanding of ASCII character encoding and maybe had some fun on the way!

Sharing is caring!

1 Comment on “ASCII Art

Leave a Reply

Your email address will not be published.