StudyToCert

All certifications / PCEP / Lessons

PCEP – Certified Entry-Level Python Programmer PCEP-30-02 · Domain 1: Computer programming and Python fundamentals

Binary, octal and hexadecimal integer literals (0b, 0o, 0x)

▶ Watch the overview video

Last reviewed September 30, 2026 · Leer en español

People normally write numbers in decimal (base 10), but computers store them in binary (base 2), and programmers often use octal (base 8) and hexadecimal (base 16) as compact ways to write binary patterns. Python lets you write integer literals in any of these bases by adding a prefix. The prefix only changes how you write the number; the result is always an ordinary int, and print() shows it in decimal.

Free account

Keep reading for free

Create a free StudyToCert account to read the rest of this lesson: 7 more sections, 6 key terms, a real-world example, an exam tip and self-check questions. Every lesson, lab and practice test is free with an account.

Sign up free Log in

Study PCEP for free
A week-by-week plan with every lesson, quizzes, checkpoint tests, a practice exam and hands-on labs.
Open the PCEP study plan