Back to Python course
PyValues and TypesBeginnerLive Python10 min
Type Conversion
Convert text into numbers before calculating.
Explanation cell
Sometimes values arrive as text but need to be used as numbers. Python lets you convert values using functions such as int(), float() and str().
int()float()str()converting values
Quick tip
Run small edits often. Tiny feedback loops make Python easier to learn.
Common mistake
Most early errors come from unmatched quotes, misspelled names or indentation.
Code cell
Starter code · Ctrl+Enter runs · Ctrl+Shift+Enter tests
Python runtime loads on first run
Output cell
Run your code to see output.
Run your code to see output.
Test cell
Tests run against the actual Python output.
Run tests to check your code against the lesson goals.
Practice cell
Try this
Convert a string price into a float and add 1.
Expected output
50