Revise Computing
Revision notesQuestionsFor schools
Log inStart revising free
Revision notesQuestionsFor schoolsLog in
GCSE Computer Science/Supplementary programming practice/Concatenation and Basic Strings

Strings + Numbers

301.5 Concatenation and Basic Strings

Practise exam questions

Concatenation and Basic Strings — Note 2 of 3

Convert before joining.

What you need to know

You cannot concatenate a string and a number directly. Use str() to convert the number first, or use commas in print() which adds spaces automatically.

What to know

  • "Score: " + 10 causes TypeError
  • Fix: "Score: " + str(10)
  • print("Score:", 10) works — commas auto-convert
  • Use str() to cast numbers before concatenating

Code examples

Joining strings and numbers
python
score = 95
print("Score: " + str(score))
print("Score:", score)
← Previous noteString concatenation301.5 Concatenation and Basic StringsNext note →Readable output301.5 Concatenation and Basic Strings

Back to Concatenation and Basic Strings

Specification notes for programming are in Paper 2.

Concatenation and Basic Strings

Note 2 of 3

  1. 1String concatenation
  2. 2Strings + Numbers
  3. 3Readable output
Topic overview

© 2026 Revise Computing · revisecomputing.co.uk

Privacy noticeTermsContact

Revise Computing is an independent revision resource. It is not affiliated with, or endorsed by, OCR (Oxford Cambridge and RSA Examinations).