Skip to content

2025 Jan OPPE 2 - Set 2

Section 1 · Question 1

Extract Middle Elements from a List

Return the middle element (odd length) or two middle elements (even length) as a list. Covers n//2 indexing, parity check, and the slicing shorthand lst[start:mid+1].

Solved
Section 1 · Question 2

Shuffle a Three-Word Sentence

Rearrange words in a sentence using a 0-based index tuple. Covers split(), indexing by tuple order, and " ".join().

Solved
Section 1 · Question 3

Check If Both Numbers Have the Same Sign

Return True if both numbers are strictly positive, both strictly negative, or both zero. Covers the three-case sign check and why zero is its own category.

Solved
Section 2 · Question 1

Check Palindrome (Advanced)

Palindrome check ignoring spaces, punctuation, and case. Covers str.isalnum(), c.lower(), and cleaned[::-1]. Also notes a problem statement error in the examples.

Solved
Section 2 · Question 2

Abbreviate Initials and Sort (Last, F.M. Format)

Convert full names to "Last, F.M." format and print sorted. Full I/O - covers "".join() for no-space initials and surname-first formatting.

Solved
Section 3 · Question 1

Employee Task Analysis

Four operations on employee records - total tasks, most efficient employee, sort by hours, productive members. Covers negated tuple keys for descending sort and efficiency ratio tie-breaking.

Solved
Section 3 · Question 2

Simple Stemmer

Strip the first matching suffix from each word in a file, preserving line structure. File I/O → stdout - covers first-match-wins suffix scanning, next() pattern, and blank line handling.

Solved