F-String Formatting
An f-string embeds variable values directly inside a string using the f"...{variable}..." syntax
Understanding F-String Formatting in Python
What it does: int() converts a numeric string to an integer. str() converts a number to a string — useful for concatenation. int() truncates — it cuts off the decimal, it does not round. str() always produces a string — not a float. float() adds a decimal point — the integer 5 becomes 5.0. Python can't add a string and a number — use int('5') + 3 instead. int('10') converts '10' to the number 10, then 10 + 5 = 15. str(5) converts 5 to a string — type() then reports it as 'str'.
Common mistakes: Line 2 should use int() not str(). Use: number = int(text). Line 2 can't add string + int. Convert first: next_age = int(age) + 1.
Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.
This module's key terms are also in a printable crossword (Modules 1–10) and word search (Modules 1–20).
Take this worksheet further — free with Cloodit
Each concept is reinforced from every angle — learned, then applied, then tested.
Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.
Over 100 of them, across seven natural biomes.
Turns their work into revision material ready for Flash Cards and Exam study.
Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.
Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.
Quick Questions
int("5") return?str(42) return?float("3.14") return?int(3.9) return?str(100) convert 100 to?Match the Pairs
Key Term
int("5")Fill in the Blanks
Spot the Error
Student with a class code? Join your class →