CoursePython from Scratch to Intermediate · Module 2: Values, Types and Operators · part 16 of 75
Part 16 · Module 2: Values, Types and Operators

Lesson 3: Converting between types, from text to pence

13 min read·14 Oct 2026
Module 2 · Lesson 3 · About 35 minutes · Needs: Lessons 1 and 2 of this module (numbers, strings, booleans, None, type())

The situation

Amira wants to know what Ben owes. You know the sums from Lesson 1. But the shelf's records hold lines of text, like Ben's loan, L13,B20,Ben,21,, and the "21" in that line looks like a number without being one. Before the program can do a single sum it has to turn text into numbers, and at the end turn the answer back into text for Amira to read. This lesson covers those conversions and the small operators that go with them.

The rest of this part opens with an account

Signing up is free and takes one email. Nothing to pay, and nothing renews.