Quiz Space

Programming in Python OPPE 2: May 2025, Set 1 (May 2025 term)

Question 1

+10 marksProgramming

Write a function compute_electricity_bill(units) that returns the bill for units units of electricity. The whole consumption is charged at the rate of the slab it falls in:

  • up to 200 units: 0.50 per unit.
  • 201 to 400 units: 0.75 per unit, plus a fixed charge of 150.
  • more than 400 units: 0.90 per unit, plus a fixed charge of 300.

The bill you return is compared after rounding it to 4 decimal places.

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

compute_electricity_bill(200) -> 100
compute_electricity_bill(412) -> 670.8

Your task

Implement this function:

def compute_electricity_bill(units: int) -> float:

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

Example

Input

200

Output

100

Question 2

+10 marksProgramming

Write a function is_reverse_combined_palindrome(s1, s2) that reverses the string s1, joins s2 to the end of it, and returns True if the resulting string is a palindrome (it reads the same forwards and backwards). 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_reverse_combined_palindrome("mad", "am") -> False
is_reverse_combined_palindrome("dam", "am") -> True

Your task

Implement this function:

def is_reverse_combined_palindrome(s1: str, s2: 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: s1, s2.

Example

Input

"mad"
"am"

Output

False

Question 3

+10 marksProgramming

Write a function is_pangram(text) that returns True if every letter of the English alphabet, from a to z, appears at least once in text, without regard to upper or lower case. Other characters in text are ignored. 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_pangram("the quick brown fox jumps over the lazy dog") -> True
is_pangram("this is not a pangram") -> False

Your task

Implement this function:

def is_pangram(text: 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: text.

Example

Input

"the quick brown fox jumps over the lazy dog"

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 2 May 2025 Set 1 paper

The IIT Madras BS Programming in Python (Python) OPPE 2 paper sat on May 2025, in the May 2025 term (T2 2025), 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 2 May 2025 Set 1 at a glance
TermMay 2025 term (T2 2025)
SubjectProgramming in Python
Course codeBSCS1002
Questions7
Marks100
Duration180 min
Programming7
Official paperOPPE 2, May 2025 Set 1
Negative markingNo negative marking.
Updated

Other sets that day

Same OPPE 2, other subjects

More Python