Python or Java for IB Computer Science? 2027 syllabus

Python or Java for the new IB Computer Science course? What the 2027 guide says about Paper 2, OOP and the IA, with side-by-side code and a decision table.

Python or Java for IB Computer Science? 2027 syllabus

By Yuness, qualified Computer Science teacher and former Head of KS5 Computer Science · Last reviewed 21 November 2026

The new IB Computer Science course (first assessment May 2027) can be taught in either Python or Java, and the IB writes every exam question that contains code in both languages. The syllabus is the same whichever you choose, and the two versions of each question are designed to be equivalent. The real differences show up in how naturally each language handles the object-oriented programming (OOP) in B3 and the abstract data types in B4, and in how quickly beginners get going. Python is usually the smoother start, while Java maps more directly onto the OOP vocabulary the guide uses.

Question

What the IB says (as of November 2026)

What it means in practice

Which languages are allowed?

Python or Java only

Departments usually pick one and teach the whole course in it

Paper 2

Two versions, one for Python students and one for Java students

Equivalent questions testing the same skills, in your language

Syllabus content

Course material is not specific to either language

B1 to B4 are identical whichever you choose

Built-in functions

Useful and encouraged in the IA; some exam questions will ban specific ones

Python students must still learn to write the algorithm by hand

Pseudocode

Not mentioned for the exams in the new guide (only as one option in the IA); B1.1 asks students to trace flowcharts

Students read and write real code in their chosen language

What the IB says about Python and Java in the 2027 course

The IB's Computer Science subject brief (first assessment 2027) states that the course can be studied in either Python or Java, that students can answer questions in either language, and that questions requiring programming will have equivalent versions to choose from. The IB's computer science updates page adds that first teaching was August 2025, first assessment is May 2027, and that every student is assessed on programming knowledge in Paper 2.

The full Computer science guide (published February 2025 and available to schools through the IB's Programme Resource Centre) goes further. It says students develop their programming skills in "the relevant programming language: Java or Python", that course material is not specific to either, and that exam questions which include code will have one Java and one Python version.

This is a real change. For the outgoing course (last assessed in 2026), the IB's course page said there was no designated language and that algorithmic thinking was assessed at the level of pseudocode. In the new course, students work in real code throughout.

How the language choice affects Paper 2

Paper 2 covers Theme B (computational thinking, programming, OOP and, at HL, abstract data types). According to the subject brief it lasts 1 hour 15 minutes at SL (35%) and 2 hours at HL (40%). The guide describes two versions of the paper at both levels: one for students who studied Python and one for students who studied Java.

What stays the same

  • The topics, command terms and skills being assessed.

  • One question on algorithmic thinking that does not involve reading or writing code. The guide says this question appears at SL and is repeated at HL.

  • Flowcharts. B1.1 asks students to trace flowcharts for a range of algorithms, which is language-neutral.

Built-in functions: the Python trap

The guide notes that Python has many built-in functions, and names sort, pop, len, max and min as useful, even encouraging them in the IA. It also warns that certain exam questions will prohibit specific built-in functions, and that these will be clearly indicated on the paper. In practice, Python students must still be able to write a sort, or find a maximum with a loop, by hand. Teach both routes from the start.

What about pseudocode?

The guide mentions pseudocode only once: as one acceptable way to present algorithms in the IA's system overview (criterion C), alongside natural language and flowcharts. It says nothing about pseudocode in the exams. Code questions come in Java or Python, and the language-neutral skills appear as flowchart tracing (B1.1.4) and the Paper 2 question on algorithmic thinking without code.

OOP (B3) and abstract data types (B4): where the languages differ most

B3.1 (fundamentals of OOP for a single class) is for SL and HL; B3.2 (multiple classes) and B4.1 (abstract data types) are HL only. The guide's learning statements use vocabulary that Java has keywords for, and Python mostly handles by convention. You can teach every statement in either language, but the Python version needs more explanation. Every behaviour below was checked by running code in Python 3.13 and Java 21.

Syllabus point

Java

Python

B3.1.5 Access modifiers (private, public)

private and public are keywords; the compiler rejects access to a private field from another class

No access-modifier keywords. A leading double underscore triggers name mangling, but the attribute can still be reached from outside

B3.1.3 Static vs non-static

static keyword on variables and methods

Class variables versus instance variables; @staticmethod and @classmethod decorators

B3.2.1 Protected and default access

Both exist in the language

No direct equivalent; taught as concepts

B3.2.2 Static polymorphism

Method overloading by parameter list

Defining a method twice with the same name replaces the first, so overloading is not native

B3.2.3 Abstract classes

abstract keyword

The abc module (ABC, @abstractmethod)

B4.1.6 Hash tables and sets

HashMap, HashSet

dict, set

B2.1.1 Data types (Boolean, char, decimal, integer, string)

Has a separate char type

No separate char type; a single character is a string of length 1

None of this makes Python the wrong choice for OOP. It means a Python teacher must explicitly teach what "private" means as a design idea, because the language will not enforce it for them. For a full walk-through of the single-class content, see our B3.1 fundamentals of OOP guide, and for HL linked lists, BSTs, sets and hash tables see B4.1 abstract data types.

The same class in Python and Java

Here is a tiny Student class in both languages, with a constructor, a getter and a method that loops over the scores. Both print Ana 6.0.

Python

class Student:
    def __init__(self, name, scores):
        self.__name = name
        self.__scores = scores

    def get_name(self):
        return self.__name

    def average(self):
        total = 0
        for score in self.__scores:
            total += score
        return total / len(self.__scores)


s = Student("Ana", [6, 7, 5])
print(s.get_name(), s.average())  # Ana 6.0
class Student:
    def __init__(self, name, scores):
        self.__name = name
        self.__scores = scores

    def get_name(self):
        return self.__name

    def average(self):
        total = 0
        for score in self.__scores:
            total += score
        return total / len(self.__scores)


s = Student("Ana", [6, 7, 5])
print(s.get_name(), s.average())  # Ana 6.0
class Student:
    def __init__(self, name, scores):
        self.__name = name
        self.__scores = scores

    def get_name(self):
        return self.__name

    def average(self):
        total = 0
        for score in self.__scores:
            total += score
        return total / len(self.__scores)


s = Student("Ana", [6, 7, 5])
print(s.get_name(), s.average())  # Ana 6.0

Java

public class Student {
    private String name;
    private int[] scores;

    public Student(String name, int[] scores) {
        this.name = name;
        this.scores = scores;
    }

    public String getName() {
        return name;
    }

    public double average() {
        int total = 0;
        for (int score : scores) {
            total += score;
        }
        return (double) total / scores.length;
    }

    public static void main(String[] args) {
        Student s = new Student("Ana", new int[] {6, 7, 5});
        System.out.println(s.getName() + " " + s.average()); // Ana 6.0
    }
}
public class Student {
    private String name;
    private int[] scores;

    public Student(String name, int[] scores) {
        this.name = name;
        this.scores = scores;
    }

    public String getName() {
        return name;
    }

    public double average() {
        int total = 0;
        for (int score : scores) {
            total += score;
        }
        return (double) total / scores.length;
    }

    public static void main(String[] args) {
        Student s = new Student("Ana", new int[] {6, 7, 5});
        System.out.println(s.getName() + " " + s.average()); // Ana 6.0
    }
}
public class Student {
    private String name;
    private int[] scores;

    public Student(String name, int[] scores) {
        this.name = name;
        this.scores = scores;
    }

    public String getName() {
        return name;
    }

    public double average() {
        int total = 0;
        for (int score : scores) {
            total += score;
        }
        return (double) total / scores.length;
    }

    public static void main(String[] args) {
        Student s = new Student("Ana", new int[] {6, 7, 5});
        System.out.println(s.getName() + " " + s.average()); // Ana 6.0
    }
}

Notice what Java makes you say out loud: the type of every field, private and public, the return type of each method, and the (double) cast. Without that cast, Java would do integer division. Python's version is shorter, but the "privacy" of __name is a convention, not a rule.

Looping over a dynamic list

B2.2.2 asks students to add, remove and traverse elements in a dynamic list. The guide names 1D and 2D lists for Python, and 1D and 2D arrays plus ArrayList for Java. Both snippets print 0 Ana then 1 Chloe.

# Python
names = ["Ana", "Ben"]
names.append("Chloe")
names.remove("Ben")
for i in range(len(names)):
    print(i, names[i])
# Python
names = ["Ana", "Ben"]
names.append("Chloe")
names.remove("Ben")
for i in range(len(names)):
    print(i, names[i])
# Python
names = ["Ana", "Ben"]
names.append("Chloe")
names.remove("Ben")
for i in range(len(names)):
    print(i, names[i])
// Java
import java.util.ArrayList;

public class Names {
    public static void main(String[] args) {
        ArrayList<String> names = new ArrayList<>();
        names.add("Ana");
        names.add("Ben");
        names.add("Chloe");
        names.remove("Ben");
        for (int i = 0; i < names.size(); i++) {
            System.out.println(i + " " + names.get(i));
        }
    }
}
// Java
import java.util.ArrayList;

public class Names {
    public static void main(String[] args) {
        ArrayList<String> names = new ArrayList<>();
        names.add("Ana");
        names.add("Ben");
        names.add("Chloe");
        names.remove("Ben");
        for (int i = 0; i < names.size(); i++) {
            System.out.println(i + " " + names.get(i));
        }
    }
}
// Java
import java.util.ArrayList;

public class Names {
    public static void main(String[] args) {
        ArrayList<String> names = new ArrayList<>();
        names.add("Ana");
        names.add("Ben");
        names.add("Chloe");
        names.remove("Ben");
        for (int i = 0; i < names.size(); i++) {
            System.out.println(i + " " + names.get(i));
        }
    }
}

One teaching point in Java's favour: B2.2.1 asks students to compare static and dynamic data structures. Java has both side by side (a fixed-size array and a resizable ArrayList), whereas Python's list is always dynamic.

Data structures, file handling and exceptions side by side

The guide itself lists the language-specific tools students are expected to know. This is the most useful table for a department planning schemes of work.

Topic

Java (as named in the guide)

Python (as named in the guide)

B2.2 Arrays and lists

1D and 2D arrays, ArrayList

1D and 2D lists

Selection

if, else, else if

if, else, elif

Exception handling

try/catch with finally

try/except with finally

B2.5 File processing

Scanner, FileWriter, BufferedReader

open(), read(), readline(), write(), close()

B4.1 Hash structures (HL)

HashMap, HashSet

dict, set

Our B2.1 programming fundamentals guide covers variables, data types and scope with this two-language exam in mind.

Typing, beginners and tooling

Static vs dynamic typing

Java is statically typed: every variable has a declared type, and the compiler rejects mismatches before the program runs. Assigning a string to an int variable produces a compile error. Python is dynamically typed: the same variable can hold 5 and then "five", and type problems only appear when that line runs. Static typing catches some errors earlier but adds syntax for beginners; dynamic typing is quicker to start with but lets type mistakes slip through until run time.

Ease for beginners

Compare the two snippets above: Python's first working program needs no class, no types and no main method, while Java needs all three before anything prints. For a class starting from zero, that means less syntax to learn before students see results, which helps in a two-year course that also contains a 35-hour IA. Java asks for more up front, but that structure becomes an advantage once you reach B3 and B4, where the same keywords are the syllabus vocabulary.

Tooling

Python code runs directly through the interpreter. Java code is compiled first (with javac from a Java Development Kit) and then run. Either way, school machines need the language installed (a Python interpreter, or a JDK for Java) plus a suitable editor or IDE, unless you use a browser-based environment. Both languages are supported by major IB course platforms: Kognity says it supports both, and CodeHS offers both tracks with Python as its default.

The IA: does the language matter?

The IA is a computational solution to a real-world problem of the student's choosing, worth 30% at SL and 20% at HL, with 35 recommended hours (per the subject brief). The guide says all solutions must be coded and can take a number of forms, and it encourages the use of built-in functions and existing libraries where they help.

The guide (February 2025 edition) does not explicitly name a language for the IA or restrict it to Python or Java. Some providers say the language choice runs through the IA; others say the IA is not formally restricted. Until your coordinator confirms otherwise, the safe advice is to build the IA in the language you are taught, because that is where the student has support and feedback. If you are hunting for a project, our sibling post on IB Computer Science IA ideas for 2027 has suggestions that work in either language.

What other IB teachers and providers say

  • An InThinking blog post, "Python or Java: the great debate for IB Computer Science" (no author or date shown), sets out strengths and weaknesses of each (including Python's readability and libraries and Java's object-oriented foundation) without recommending one, and says that "the ultimate decision on which language to choose lies with the teachers".

  • Ioana Ganea, a Computer Science teacher and IB examiner writing for ManageBac (April 2025), notes that the content was designed to support both languages and that OOP, formerly option D, is now studied at SL and HL.

  • AssessPrep (May 2026) describes the choice as a department-level decision that runs through teaching, the IA and the exam.

  • Lanterna (July 2026) tells students that neither language gives them an advantage.

Python or Java: a decision table

Choose Python if…

Choose Java if…

Most of your students are new to programming

Your students already know Java (or a similar typed language)

Your department's main expertise and resources are in Python

Your teachers are confident in Java and have existing OOP material

Your lower-school curriculum (for example GCSE or MYP) already uses Python

You have a large HL group and want OOP and ADT terms (private, protected, abstract, overloading) to map directly onto keywords

Your school machines already have Python set up and installing a JDK would be difficult

You want the static vs dynamic data structure comparison (array vs ArrayList) built into the language

You want students productive quickly so the IA can start sooner

You are happy to invest early time in syntax and types to save time in B3 and B4

If the table splits evenly, my advice is to choose the language your teachers know best and can support confidently for two years, including helping with every student's IA. Make the decision before first teaching rather than switching part way through a cohort.

For students and parents: if your school gives you a choice

Most schools pick one language for the whole class, so many students will not have a choice. If yours does, pick the language you have already used. If you are starting from scratch, Python is usually the gentler start, but plan to spend extra time on OOP concepts that Python does not enforce. Whichever you choose, practise writing standard algorithms without built-in shortcuts, because the exam may ban them.

FAQ

Can IB Computer Science students choose between Python and Java?

The IB allows the course to be taught in either language, and exam questions with code come in both versions. In practice the school or department usually chooses one language for the class. Ask your DP coordinator how your school handles it.

Is Java or Python better for the IB Computer Science exam?

Neither has an official advantage: the IB says code questions will have equivalent versions in each language. Java maps more directly onto the OOP keywords in B3, while Python is quicker for beginners but needs care when built-in functions are prohibited.

Is pseudocode still used in the new IB Computer Science course?

The new guide does not mention pseudocode for the exams. Code questions are set in Java or Python, and B1.1 asks students to trace flowcharts. Pseudocode appears in the guide only as one acceptable way to present algorithms in the IA's system overview.

Do I have to write my IA in Python or Java?

The guide says the solution must be coded, but it does not explicitly restrict the IA to Python or Java, and providers' advice differs. Check with your teacher and coordinator, and default to the language you are taught in.

Is OOP compulsory at SL?

Yes. B3.1 (OOP for a single class) is for SL and HL. B3.2 (multiple classes: inheritance, polymorphism, abstraction, composition and aggregation, design patterns) and B4 (abstract data types) are HL only.

Can we switch language halfway through the course?

Nothing I found in the public IB documents covers mid-course switches, and it would mean re-teaching syntax under exam pressure. Decide before first teaching and stick with it.

Whichever language your school uses, our IB Computer Science hub has free topic guides written for the 2027 syllabus. If you would like one-to-one help with Python or Java for Paper 2 or the IA, take a look at IB Computer Science tutoring, which starts with a free 1-hour trial lesson.