Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Cipher
1. Caesar cipher

Instruction

Hello and welcome to our Python Practice: Word Games course. This set of exercises will help you practice what you've learned in our Python Basics series (Python Basics. Part 1, Python Basics. Part 2, Python Basics. Part 3).

In this part of this course, you'll undertake a mini-project. We will learn how to create a simple cipher. Fasten your seatbelts and let's get going!

Caesar cipher is one of the simplest encryption techniques based on character substitution. Each letter of a given message is replaced by another letter that is a certain number of places down the alphabet. For instance, let's say that we want to encode the word 'cat' by shifting 5 positions to the right – it would be 'hfy' because the 'h' is 5 positions after 'c', 'f' is 5 positions after 'a', and 'y' is 5 positions after 't'.

Caesar cipher explained

In Python this cipher is usually implemented with the chr() and ord() functions. Let's take a look at them and then spring into action!

Exercise

Click the Next exercise button to continue.