Unit 4 · Lesson 2
Build the idea
Start with the concept and its key vocabulary.
Python input is always a string. Cast it before a numeric calculation: int(input(...)) for a whole number or float(input(...)) for a decimal. OCR ERL also publishes real() as an alternative decimal cast. str() creates text, while bool() converts a value to a Boolean: for example, bool(1) is true.
Converting one data type into another.
A cast that converts a suitable value into an integer.
Casts that convert a suitable value into a decimal number.
A cast that converts a value into a string.
A cast that converts a suitable value into a Boolean.