Quiz Space

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

Question 1

+10 marksProgramming

Write a function get_element_at_circular_index(lst, idx) that returns the element of the non-empty list lst at the index idx, where the indexing is circular: after the last element it goes on from the first element again, and a negative index counts back from the end in the same way. For a list of 3 elements, index 3 is the first element, index 4 is the second element, and index -1 is the last one.

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

get_element_at_circular_index([1, 2, 3], 4) -> 2
get_element_at_circular_index([10, 20, 30, 40], -1) -> 40

Your task

Implement this function:

def get_element_at_circular_index(lst: list, idx: int):

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: lst, idx.

Example

Input

[1, 2, 3]
4

Output

2

Question 2

+10 marksProgramming

Write a function signed_abs_diff_of_middle_digits(n) that looks at the digits of n (without its sign). If there is an odd number of digits, take the single middle digit. If there is an even number of digits, take the absolute difference of the two middle digits. The function returns that number, with a minus sign if n is negative.

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

signed_abs_diff_of_middle_digits(12345) -> 3
signed_abs_diff_of_middle_digits(-987) -> -8

Your task

Implement this function:

def signed_abs_diff_of_middle_digits(n: int) -> int:

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: n.

Example

Input

12345

Output

3

Question 3

+10 marksProgramming

Write a function is_decreasing_number(n: int) -> bool that checks if a given 4-digit number is decreasing, meaning each digit is strictly less than the digit before it (from left to right).

The function should return True if the number meets the criteria and False otherwise.

Constraints

The input number will be a 4-digit number, which means it will be in the range of 1000 to 9999.

Example

>>> is_decreasing_number(4321)
True
>>> is_decreasing_number(4312)
False
>>> is_decreasing_number(9876)
True
>>> is_decreasing_number(1111)
False
>>> is_decreasing_number(3210)
True

Your task

Implement this function:

def is_decreasing_number(n: 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: n.

Example

Input

4321

Output

True

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 1 paper

The IIT Madras BS Programming in Python (Python) OPPE 1 paper sat on Jan 2026, in the January 2026 term (T1 2026), set 1: 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 1 at a glance
TermJanuary 2026 term (T1 2026)
SubjectProgramming in Python
Course codeBSCS1002
Questions7
Marks100
Duration180 min
Programming7
Official paperOPPE 1, Jan 2026 Set 1
Negative markingNo negative marking.
Updated

Other sets that day

Same OPPE 1, other subjects

More Python