Concepts·Certified Associate Python Programmer
Python ord(), chr() and String Operations
PCAP objective 3.2 is operate on strings, and its distinctive content is `ord` and `chr` - the two functions that turn a character into its code point and back. They are examined through arithmetic: shifting letters, converting case by adding 32, and the comparison order that falls out of the ranges. The classic exercise is a Caesar cipher, and this guide runs one.
Strings in Depth Guide 10 of 25 Intermediate
- Python3.14.4
- OSUbuntu 26.04 LTS
- pip25.1.1
- TimeAbout 15 min
- Reviewed23 August 2026
Written against the versions above. Nothing here has changed in Python 3. `chr()` accepts the full Unicode range up to 0x10FFFF; in Python 2 the equivalent function `unichr` was separate and narrower.
| Server Name | IP Address | OS | Roles | CPU | RAM | HDD |
|---|---|---|---|---|---|---|
| RUNNER01 | 192.168.0.27 | Ubuntu 26.04 LTS | Python 3.14.4 - the only machine this path needs | 2 Core | 4 GB | 50 GB |
Before you start
-
ord and chr are inverses
-
The three ranges, and the gap between them
-
How ord and chr refuse
-
A Caesar shift, which is what this objective is for
-
Case conversion is arithmetic
-
The operators, on strings
-
What the exam does with this objective