StudyToCert

All certifications / PCEP / Lessons

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

Type casting with int(), float(), str() and bool()

▶ Watch the overview video

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

Type casting (type conversion) means creating a value of one type from a value of another. Python does some conversions automatically, for example turning an int into a float when you add 2 + 0.5, but it never silently turns a string into a number or a number into a string. For those you call a conversion function: int(), float(), str() or bool(). Each returns a new value; the original is unchanged, so x = "5" followed by int(x) on its own line leaves x a string unless you assign the result, as in x = int(x).

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