- Know where the written tasks are in the paper, what they weigh and how they are marked (0, ⅓, ½, ⅔, 1).
- Read from the Giriş / Çıxış table the input format, the output shape and the special case (
yoxdur). - Write a complete program from a ready skeleton for five task families: numbers in a range and divisors, remainder classes, lists, digits, strings.
- Check a program against the examples and find the typical mistakes that cost points.
At the end of the informatics part an empty field and one sentence wait on the answer sheet: “…write a program in Python that prints… For example:” — next to a small Giriş / Çıxış (input / output) table. There are no answer options: the program you write is marked by examiners (markers). There is good news too: all eight written Python tasks of the four exams of 2025–2026 belonged to a few families. If you know the skeleton of each family, the task turns into “write the condition”.
What a written task looks like and how it is marked
The informatics part is tasks 61–90: 22 closed (61–82), 5 coded (83–87) and 3 written (88–90). Task 88 asks for a flowchart (see the lesson “Building flowcharts: the written tasks”), tasks 89 and 90 for Python programs. Markers check the written tasks against criteria and give each one 0, ⅓, ½, ⅔ or 1 point. DİM does not publish the detailed criteria, so the goal is simple: a complete, correct and readable program with every part — input, calculation, output — in place.
- NBarelative score for the open tasks
- Dkodnumber of correct coded answers (0–5)
- Dyazılısum of the marks for the written tasks (0–3)
The closed part adds 100/33 · (Dq − Yq/4); the maximum for the subject is 100. A written task weighs as much as two coded tasks.
Leyla solved 4 of the 5 coded tasks correctly and got 1, ⅔ and ½ for the written tasks. What is her relative score for the open tasks? How many points is a fully solved written task “worth”?
Show solutionHide solution
NBa = (4 + 2 · 13/6) · 100/33 = (4 + 13/3) · 100/33 = 25/3 · 100/33 ≈ 25.3.
A fully solved written task gives 2 · 100/33 ≈ 6.1 points, and ⅓ of it ≈ 2.0 points (on the 100-point scale). In the Rİ subgroup informatics has the weight coefficient 1, so these points go into the total unchanged.
Conclusion: a program that starts correctly but is unfinished can still earn points — an empty field never does.
The most valuable part of the task is the Giriş / Çıxış table. The left column shows what is typed on the keyboard — each line is one input() call. The right column shows exactly what the program must print: a number, a word, a list in square brackets or several lines. Read the table like this:
- 1Count the lines
How many input lines does one example have? If the first line is
nand exactlynlines follow, readnfirst, thennnumbers in a loop. - 2Choose the type
A whole number —
int(input()); text —input(); several values on one line separated by spaces —input().split(' '). - 3Look at the output shape
One number — one
printafter the loop;[15, 6, 7]—print(b); each number on its own line —printinside the loop. - 4Check the rule
Work out one example by hand: why exactly this answer? Watch the difference between “greater” and “greater or equal”, “count” and “sum”.
- 5Find the special case
If one output is a word instead of a number (
yoxdur, Azerbaijani for “none”), you need anif–elseafter the loop.
| In the Giriş column | In the program |
|---|---|
| one number | n = int(input()) |
| two numbers on two lines | a = int(input()), b = int(input()) |
n, then n numbers, each on its own line | for i in range(0, n): a.append(int(input())) |
| values on one line separated by spaces | a = input().split(' ') — the elements are strings |
| one line of text | s = input() |
The skeleton of a program: input → processing → output
Every exam program has three parts, always written in this order. Input: all input() lines at the start. Processing: a counter or a sum is set to zero before the loop (k = 0, s = 0, b = []), the loop checks the condition and collects the result. Output: without indentation, after the loop — with a yoxdur branch if needed. The ten examples below fall into five families; the first solution of each family is the skeleton for the whole family.
Model solutions: five families, ten tasks
Family 1 — numbers in a range and divisors. The loop runs over range(a, b + 1) or range(1, n + 1), and a counter or a sum grows when the condition holds. In 2025–2026 this family gave tasks of the types “squares of odd numbers in a segment” and “sum of the odd divisors”.
Write a Python program that, for natural numbers a and b (a < b) entered from the keyboard, prints the sum of the even perfect squares (4, 16, 36, …) in the segment [a, b], or the word yoxdur if there are none.
Giriş → Çıxış (a and b on separate lines)
10, 70 → 116
50, 60 → yoxdur
1, 4 → 4
Show solutionHide solution
range(a, b + 1).Perfect square test:
r = int(x ** 0.5) and r * r == x — exact, because it uses whole numbers.Even:
x % 2 == 0. The sum s is 0 before the loop.A sum of natural numbers is 0 only when no number was found, so after the loop
if s == 0: → yoxdur.Check: [10, 70]: 16 + 36 + 64 = 116 ✓.
a = int(input())
b = int(input())
s = 0
for x in range(a, b + 1):
r = int(x ** 0.5)
if x % 2 == 0 and r * r == x:
s = s + x
if s == 0:
print('yoxdur')
else:
print(s)Write a program that prints, on one line separated by a space, the number and the sum of the even divisors of a natural number n.
Giriş → Çıxış
36 → 6 78
15 → 0 0
8 → 3 14
Show solutionHide solution
n itself → range(1, n + 1).The condition has two parts:
n % d == 0 (divisor) and d % 2 == 0 (even), joined with and.Both results are collected in the same loop;
print(k, s) prints them separated by a space.Check: the even divisors of 36 are 2, 4, 6, 12, 18, 36 → 6 numbers, sum 78 ✓.
n = int(input())
k = 0
s = 0
for d in range(1, n + 1):
if n % d == 0 and d % 2 == 0:
k = k + 1
s = s + d
print(k, s)Family 2 — remainder classes. Numbers are written into a table like a snake, and you are asked in which column a number lies. Two rows of the table form one period: with 3 columns the period is 6, with 4 columns it is 8. In 2025 this family gave a table with three columns.
Natural numbers are written into the columns A, B, C, D like this: row 1 is 1 2 3 4, row 2 is 8 7 6 5, row 3 is 9 10 11 12, row 4 is 16 15 14 13, and so on. Write a program that prints the column of the entered number a.
Giriş → Çıxış
7 → B
12 → D
16 → A
30 → C
Show solutionHide solution
So: A — remainder 1 or 0; B — 2 or 7; C — 3 or 6; D — 4 or 5.
8, 16, 24, … have remainder 0 and lie in column A — do not forget this case.
Check: 30 % 8 = 6 → C ✓ (row 8: 32 31 30 29).
a = int(input())
r = a % 8
if r == 1 or r == 0:
print('A')
elif r == 2 or r == 7:
print('B')
elif r == 3 or r == 6:
print('C')
else:
print('D')Family 3 — n numbers read into a list. First n, then n numbers are read and collected in an empty list; then the list is processed either as a whole (min, max, sum) or element by element. In 2026 this family gave tasks of the types “each element plus the smallest element” and “files that fill whole clusters”.
n integers are entered from the keyboard into an empty list. Write a program that prints a new list whose elements are the differences between the largest element of the original list and each element.
Giriş → Çıxış (the first number is n, each number on its own line)
4, 3, 10, −2, 7 → [7, 0, 12, 3]
3, 5, 5, 1 → [0, 0, 4]
Show solutionHide solution
n = int(input()), a = [], a.append(int(input())) in a loop.m = max(a) is computed once, before the second loop.The new list
b is built from empty: b.append(m - x).The output has square brackets →
print(b).Check: max = 10 → 10 − 3, 10 − 10, 10 − (−2), 10 − 7 = [7, 0, 12, 3] ✓.
n = int(input())
a = []
for i in range(0, n):
a.append(int(input()))
m = max(a)
b = []
for x in a:
b.append(m - x)
print(b)The sizes in KB of the n files of a folder are entered into an empty list. If the cluster size is 8 KB, write a program that prints the total space (in KB) the files occupy on the disk.
Giriş → Çıxış
3, 20, 8, 1 → 40
4, 16, 17, 7, 40 → 88
Show solutionHide solution
Number of clusters:
x // 8, plus 1 if there is a remainder (rounding up).20 KB → 3 clusters = 24 KB; 8 → 8; 1 → 8. Total 40 ✓.
Check 2: 16 + 24 + 8 + 40 = 88 ✓.
n = int(input())
a = []
for i in range(0, n):
a.append(int(input()))
s = 0
for x in a:
k = x // 8
if x % 8 != 0:
k = k + 1
s = s + k * 8
print(s)n integers are entered into an empty list. Write a program that prints how many elements are greater than the arithmetic mean.
Giriş → Çıxış
5, 4, 9, 1, 6, 10 → 2
3, 5, 5, 5 → 0
Show solutionHide solution
m = sum(a) / n is computed before the loop; / gives a fraction (6.0), which is no problem for comparing.The condition is strict: “greater” →
x > m, not >=.Check: (4 + 9 + 1 + 6 + 10) / 5 = 6; greater than 6 are 9 and 10 → 2 ✓. If all elements are equal, none is greater than the mean → 0.
n = int(input())
a = []
for i in range(0, n):
a.append(int(input()))
m = sum(a) / n
k = 0
for x in a:
if x > m:
k = k + 1
print(k)Family 4 — the digits of each number. The digits of every number are checked separately; it is convenient to put this into a helper function (see the lesson “Functions: def, parameters and return”). In 2026 the task “numbers whose digits are all odd” came from this family.
Write a program that prints, each on its own line, those of the n natural numbers entered from the keyboard whose digits are all even, or the word yoxdur if there are none.
Giriş → Çıxış
4, 248, 1234, 60, 7 → 248 and 60 (on two lines)
2, 13, 5 → yoxdur
Show solutionHide solution
even_digits(n) checks the digits one by one from the end: as soon as an odd digit is found, return False; if the loop ends, return True.A matching number is printed inside the loop (the output has several lines), and the counter
k is needed for yoxdur.Check: 248 → 8, 4, 2 even ✓; 1234 → 4 even, 3 odd ✗; 60 ✓; 7 ✗.
def even_digits(n):
while n > 0:
if n % 10 % 2 == 1:
return False
n = n // 10
return True
n = int(input())
a = []
for i in range(0, n):
a.append(int(input()))
k = 0
for x in a:
if even_digits(x):
print(x)
k = k + 1
if k == 0:
print('yoxdur')For natural numbers a and b (a < b), write a program that prints how many palindromic numbers (like 121, 44, 7 — the same when read backwards) lie in the segment [a, b].
Giriş → Çıxış
10, 60 → 5
100, 130 → 3
1, 9 → 9
Show solutionHide solution
str(x) == str(x)[::-1] — the string equals its reverse.You may also write
x == rev(x) with the rev function from the lesson “Functions: def, parameters and return”.Check: [100, 130]: 101, 111, 121 → 3 ✓. All one-digit numbers are palindromes.
a = int(input())
b = int(input())
k = 0
for x in range(a, b + 1):
if str(x) == str(x)[::-1]:
k = k + 1
print(k)Family 5 — strings. A string is either read whole (s = input()) and walked character by character, or cut into pieces with split(' '). In 2025 this family gave tasks of the types “number of different characters in a string” and “sum of the indexes of the elements that start with 3 and end with 6”.
Write a program that prints how many characters occur exactly once in a string entered from the keyboard.
Giriş → Çıxış
abracadabra → 2
python → 6
10 + 20 = 30 → 5
Show solutionHide solution
ch check s.count(ch) == 1; a space is a character too.“10 + 20 = 30”: 0 occurs three times, the space four times; the ones that occur once are 1, +, 2, =, 3 → 5 ✓.
A different question — “the number of different characters” — has another skeleton: add every character to a new string or list only once and print
len at the end.s = input()
k = 0
for ch in s:
if s.count(ch) == 1:
k = k + 1
print(k)The elements of a list are entered on one line separated by one space. Write a program that prints the list of the indexes of the elements whose first and last characters are the same, or the word yoxdur if there are none.
Giriş → Çıxış
aba 12 x 707 ab 55 → [0, 2, 3, 5]
ab cd → yoxdur
Show solutionHide solution
a = input().split(' ') gives the elements as strings — no conversion to numbers is needed here, because characters are compared.The indexes are needed →
for i in range(0, len(a)); the element is w = a[i], its first character w[0], its last w[-1].For the one-character “x”,
w[0] and w[-1] are the same character → it counts.Check: aba (0), x (2), 707 (3), 55 (5) → [0, 2, 3, 5] ✓.
a = input().split(' ')
b = []
for i in range(0, len(a)):
w = a[i]
if w[0] == w[-1]:
b.append(i)
if len(b) == 0:
print('yoxdur')
else:
print(b)Mistakes that cost points, and self-checking
| Mistake | What happens | Fix |
|---|---|---|
no int: a = input() | strings are glued: '12' + '5' = '125'; comparison is alphabetical: '9' > '10' | a = int(input()) |
range(1, n) | n itself is not checked: the divisor n or the end b of the segment is lost | range(1, n + 1) |
print inside the loop | many lines instead of one number | write print after the loop, without indentation |
no yoxdur branch | with no matching number, 0 or an empty list is printed | after the loop if k == 0: → print('yoxdur') |
| extra text in the output | input('n='), print('k =', k) — the output does not match the Çıxış column | input() and a print of exactly what is asked |
| the counter is not initialised | a NameError or a wrong sum | k = 0, s = 0, b = [] before the loop |
syntax: if x = 5, a missing :, mixed indentation | the program does not run at all | == compares, = assigns; 4 spaces per block |
- 1Trace the examples
Run every Giriş example through the program with a table of variables; the result must match the Çıxış column exactly.
- 2Check the edges
The case with no matching element (
yoxdur), a one-element list, the ends a and b of the segment themselves. - 3Check the output shape
One
printafter the loop? The list in brackets? The word exactly as in the task (yoxdur)? - 4Check the syntax
Colons, indentation,
==in conditions, the two pairs of parentheses inint(input()). - 5Re-read the task
“count” or “sum”? “odd” or “even”? “greater” or “greater or equal”?
def solve(a, b):
s = 0
for x in range(a, b + 1):
r = int(x ** 0.5)
if x % 2 == 0 and r * r == x:
s = s + x
if s == 0:
return 'yoxdur'
return s
tests = [(10, 70, 116), (50, 60, 'yoxdur'), (1, 4, 4)]
for a, b, expected in tests:
got = solve(a, b)
print(a, b, got, got == expected)▸ Expected output
10 70 116 True 50 60 yoxdur True 1 4 4 True
When you prepare at home, check a program like this: turn the calculation into a function and run all the examples of the task at once. Then replace b + 1 with b and run it again — the third test gives False. This is what a mistake-catching test looks like: the right end of the segment (b = 4) is itself the answer.
In the exam a and b would be read from the keyboard (a = int(input()), b = int(input())); here they are given. Print how many numbers in the segment [a, b] have a digit sum of 9, or the word yoxdur if there are none.
a = 20
b = 60
# exam version: a = int(input()) and b = int(input())▸ Expected output
4
The elements are entered on one line separated by one space (in the exam line = input()). Print the sum of the indexes of the elements that are greater than the element before them (the element with index 0 has no element before it).
line = '7 12 5 30 8'
# exam version: line = input()▸ Expected output
4
The best way to prepare for the written tasks is to write one task of each family on paper against the clock and then check it on a computer with the examples. Reading programs (closed and coded tasks) is practised in the lesson “Analysing programs: from the output back to the input”, and the flowchart of task 88 in the lesson “Building flowcharts: the written tasks”.
Key points
- Tasks 89 and 90 are Python programs; markers give 0, ⅓, ½, ⅔ or 1 point, and one written task weighs as much as two coded tasks.
- The Giriş column shows the
input()calls, the Çıxış column exactly what must be printed. - The skeleton is always the same: input → a counter, a sum or an empty list → loop and condition → output after the loop.
- A word output (
yoxdur) needs anif–elseafter the loop. - The mistakes that cost the most: no
int,range(1, n),printinside the loop, extra text in the output.
Check yourself
12 questions. Every correct answer earns XP.