Skip to content

2025 May OPPE 2 - Set 1

Section 1 · Question 1

Compute Electricity Bill

Three-slab billing - flat rate per unit with optional fixed charges. Covers if-elif-else ordering, flat vs tiered billing distinction, and a noted problem statement error for 210 units.

Solved
Section 1 · Question 2

Is Reverse Combined Palindrome

Reverse the first string, concatenate with the second, check if palindrome. Covers s1[::-1], string concatenation, and combined == combined[::-1].

Solved
Section 1 · Question 3

Pangram Check

Return True if a string contains all 26 letters. Covers set.issubset(), the <= subset operator, all() short-circuiting, and string.ascii_lowercase.

Solved
Section 2 · Question 1

Check for Arithmetic Progression

Verify all consecutive differences are equal. Covers diff = seq[1] - seq[0], all() with range, zip(seq, seq[1:]), and the len(set(diffs)) == 1 trick.

Solved
Section 2 · Question 2

Rotate Matrix Clockwise 90°

Rotate an m×n matrix to n×m by turning columns into rows (bottom to top). Full I/O - covers the zip(*matrix[::-1]) trick and the column-index formula matrix[m-1-i][j].

Solved
Section 3 · Question 1

Book Data Analysis

Five functions on book tuples - short/medium sets, ISBN lookup, language counts, genre+language total. Covers set comprehensions, next(..., None), dict.get(k, 0), and Counter.

Solved
Section 3 · Question 2

File Content Zigzag Shift

Print each character preceded by spaces following a zigzag pattern of width z. File I/O → stdout - covers cycle length 2*(z-1), ascending/descending position formula, and itertools.cycle.

Solved