Have fun with ASCII art for GCSE Computer Science

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!

Comments are closed.

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

Join our mailing list

Join our mailing list to receive awesome articles about learning Python and Computer Science in a fun and accessible way, straight to your inbox.

 Take your Python skills to the next level!

with our free email course on object oriented programming with Python