Quiz Space

Programming in Python OPPE 1: January 2026, Set 2 (January 2026 term)

Question 1

+10 marksProgramming

Write a function is_repeated_thrice(s) that returns True if the non-empty string s is made by writing the same piece of text exactly three times one after the other, like "abcabcabc". This needs the length of s to be divisible by 3 and its three equal-sized parts to be identical. Otherwise it returns False.

NOTE: This is a function type question, you don't have to take input or print the output, just have to complete the required function definition.

Example

is_repeated_thrice("abcabcabc") -> True
is_repeated_thrice("xyzxyzxyz") -> True

Your task

Implement this function:

def is_repeated_thrice(s: str) -> bool:

Write the function only — the arguments are read for you and the return value is printed automatically.

Arguments arrive as one Python literal per line, in this order: s.

Example

Input

"abcabcabc"

Output

True

Question 2

+10 marksProgramming

Write a function is_sum_of_ends_divisible_by_k(nums, k) that returns True if the sum of the first and the last element of the tuple nums is divisible by k, and False otherwise.

NOTE: This is a function type question, you don't have to take input or print the output, just have to complete the required function definition.

Example

is_sum_of_ends_divisible_by_k((10, 20, 30), 10) -> True
is_sum_of_ends_divisible_by_k((2, 4, 6), 5) -> False

Your task

Implement this function:

def is_sum_of_ends_divisible_by_k(nums: tuple, k: int) -> bool:

Write the function only — the arguments are read for you and the return value is printed automatically.

Arguments arrive as one Python literal per line, in this order: nums, k.

Example

Input

(10, 20, 30)
10

Output

True

Question 3

+10 marksProgramming

Write a function move_even_indices_to_end_reversed(t) that returns a new tuple. It starts with the elements of t at the odd indices (1, 3, 5, ...), in their original order. After them come the elements at the even indices (0, 2, 4, ...), in the reverse order.

NOTE: This is a function type question, you don't have to take input or print the output, just have to complete the required function definition.

Example

move_even_indices_to_end_reversed((10, 20, 30, 40, 50)) -> (20, 40, 50, 30, 10)
move_even_indices_to_end_reversed((1, 2, 3, 4)) -> (2, 4, 3, 1)

Your task

Implement this function:

def move_even_indices_to_end_reversed(t: tuple) -> tuple:

Write the function only — the arguments are read for you and the return value is printed automatically.

Arguments arrive as one Python literal per line, in this order: t.

Example

Input

(10, 20, 30, 40, 50)

Output

(20, 40, 50, 30, 10)

4 more questions in this paper

Sign in with Google — it is free — to see every question with its answer and explanation, practise it in learning mode, or take it as a timed mock test.

More on the Python OPPE 1 Jan 2026 Set 2 paper

The IIT Madras BS Programming in Python (Python) OPPE 1 paper sat on Jan 2026, in the January 2026 term (T1 2026), set 2: 7 questions for 100 marks in 180 minutes. The first 3 questions are below. Sign in with Google — it is free — to see the whole paper with its answers and explanations, in learning mode or as a timed mock test.

FeaturePython OPPE 1 Jan 2026 Set 2 at a glance
TermJanuary 2026 term (T1 2026)
SubjectProgramming in Python
Course codeBSCS1002
Questions7
Marks100
Duration180 min
Programming7
Official paperOPPE 1, Jan 2026 Set 2
Negative markingNo negative marking.
Updated

Other sets that day

Same OPPE 1, other subjects

More Python