Learn in your language
Skip to content
IGCSE · Cambridge (CIE) · 0265

Python strings and operators

Use the specified string operations and arithmetic, relational and logical operators to solve small problems.

Section Component 2 · Algorithms and Programming

Cambridge IGCSE Computer Science 0265 · 2029 syllabus · Version 1 · 8

Mapped to the Cambridge IGCSE Computer Science 0265 syllabus for exams in 2029. These original explanations and self-checks are independent study support, not Cambridge papers, official marks or grades. Practical programming is taught with worked code and trace tasks; an executable Python workspace and timed digital-exam simulation are not yet available.

Before you begin

  • Use the 2029 syllabus for this course. Cambridge specifies Python 3.10 or higher for programming and digital exams for both components. The syllabus currently identifies this route for 2029 only; confirm later-year availability with Cambridge and your school.

Work on paper. Try each question before revealing help, and explain why your method works.

Quick readiness check

Before python strings and operators, which statement is the safest starting point?

What you will learn

  • Apply string indexing, methods and concatenation
  • Use the specified arithmetic operators
  • Combine relational and logical conditions

String positions start at zero

A string is a sequence of characters. Its first character has index zero. len() returns the number of characters; find() returns the position of a substring; count() counts occurrences; upper(), lower(), title() and replace() return modified text; + concatenates strings.

String methods return values. Store or print the returned value if you need it. Concatenation does not insert spaces automatically, so include a space string where required. Check the syllabus Python guide for the exact names and behaviour expected in the exam.

Operators express calculations and conditions

The arithmetic operators include +, −, /, *, **, % and //. Modulus gives the remainder; floor division gives the integer quotient rounded down. Relational operators compare values and return a Boolean result: ==, !=, <, <=, > and >=.

Logical and, or and not combine or reverse Boolean conditions. Use brackets to make grouping clear, especially when several conditions appear. A comparison checks values; assignment stores a value. In Python, use == for equality and = for assignment.

Pause and explain

Which habit best checks your understanding of python strings and operators?

Put the idea to work

Worked example

How many characters are in 'StudyForA', and what does 'Cambridge'.lower() return?

Show the worked solution
  1. len() counts the characters in a string.
  2. StudyForA has nine characters.
  3. lower() returns a new string with lowercase letters.

Answer 9 and 'cambridge'

Try a topic test

Choose Easy, Normal or Difficult. Save your answers and open worked review after finishing.

Test this topic →

From guided practice to a new situation

Write your answer and reasoning first. Use a hint only if you are stuck. The model solution is for self-checking; your written work is not automatically marked.

1 · Guided

For text = 'Computer Science', find its length and the position returned by text.find('Science').

Give me a hint

Count all characters, including the space; find() returns a zero-based position.

Compare my reasoning
  1. 'Computer' has 8 characters and the space adds 1.
  2. 'Science' begins after those 9 characters.
  3. So the length is 16 and the starting index is 9.

len(text) = 16; text.find('Science') = 9

Look for these in your work

  • Space counted
  • Zero-based indexing used
  • Both results stated
2 · Independent

Evaluate 19 // 4, 19 % 4 and 2 ** 3.

Give me a hint

Distinguish quotient, remainder and exponentiation.

Compare my reasoning
  1. 19 // 4 is the floor quotient 4.
  2. 19 % 4 is the remainder 3.
  3. 2 ** 3 is 2 × 2 × 2 = 8.

4, 3 and 8

Look for these in your work

  • Floor division
  • Remainder
  • Power
3 · Transfer

A login is allowed when the account is active and either the user is an administrator or the entered code matches. Write a Boolean condition and explain its grouping.

Give me a hint

Combine the alternative conditions first, then require an active account.

Compare my reasoning
  1. Let active, admin and code_ok be Boolean values.
  2. Either admin or code_ok is true, so group them with or.
  3. Require active as well using and.

active and (admin or code_ok)

Look for these in your work

  • Variables clear
  • Alternatives grouped
  • Required condition combined

Common mistakes

  • Using = when a condition needs ==.
  • Forgetting that string index starts at 0.
  • Confusing / with // or % with ordinary division.
Recall without your notes

What can you explain now?

What is 17 % 5?

Compare with the explanation

2

Modulus returns the remainder after division.

After trying it yourself, choose your next review. This is your self-assessment.

Your review choice appears on Today. Sign in to sync it across devices.

Make it stick

How do Python strings, arithmetic operators and Boolean operators behave at their boundaries?

If you needed the solution, close it and solve the problem again from a blank page. A correct answer is stronger when you can explain the reason for each step.

Keep learning Computer Science

Course scope and assessment

All 11 syllabus topics link to 33 original lessons. Each lesson includes worked teaching, a check with explanation and guided, independent and application practice. This is mapped teaching, not evidence of exam readiness, teacher approval or a Cambridge grade. Cambridge specifies two externally assessed digital exams; StudyForA does not yet provide full timed digital-paper simulations or an executable Python 3.10+ workspace for practical programming. The currently published syllabus is for 2029; later-year coverage is not claimed.

StudyForA · Learn with understanding

Original teaching content and links to official sources. Check your exam year and qualification before using a resource.