Text versus number
"5" + "5" joins text, int("5") + int("5") adds numbers. Same symbols, different types.
Every value has a type. type() and isinstance() tell you which, and int(), float(), str() and bool() convert between types when the conversion makes sense. Python never converts text and numbers silently, so "5" + 5 is an error.
Change the code and press Run (Ctrl+Enter). Predict what will happen first, then break it on purpose and read what changes. Your edits are saved and match the lesson page.
Ready for more? This phase has 6 hands-on exercises with automatic checks.
Practice questions
Write the code in the editor, run it, then open the model answer to compare.
Convert the text "250" to a number, add 50, and print the total.
Turn the number 7 into text and use it to print Lucky number: 7 by joining strings with +.
Turn the text "9.99" into a whole number by cutting off the decimals, and print it.
Explain it without notes
What is the difference between type(x) and isinstance(x, int)?
Why does Python refuse "5" + 5, and what are the two ways to resolve it?
What does int(-3.9) give, and what does that tell you about int() on floats?
What is the difference between a ValueError and a TypeError in conversions?
Expected output
55
10
Age: 5
3
555
3.0 True None
1000.0 1