Registry Synced

Jan 2026 - Python - Week 9 - PPA 15

401 words
2 min read

PPA 15

Course: Jan 2026 - Python
PPA 15
Due Dec 31, 2026 at 11:59 PM IST
Instructions
Use "Test Run" to verify your code with public test cases.
Press "Submit" to have your assignment evaluated.
You can submit your assignment multiple times up until the deadline.
Make sure to submit your final code by the deadline to receive your score.
Summary
- out of100
Score
Public Tests
0/0 Passed
Private Tests
0/0 Passed

You have a locker that has a finite number of coins in it. Each coin has some positive integer that is engraved on it. This denotes how valuable the coin is. You wish to draw a subset of coins from the locker whose total worth is ss. Your task is to determine if this can be done with the coins available in your locker.

Write a recursive function named subset_sum that accepts a list of positive integers L and a positive integer s as arguments. The list L represents the coins in your locker. The integer s represents the total value of the coins that you need to withdraw. Return True if you can withdraw some subset of coins whose combined worth is ss, return False otherwise.

(1) If you need a hint, come to Discourse.
(2) You do not have to accept input from the user or print the output to the console. You just have to write the function definition.

Public Tests ( 0/0 )

Case 1

Input:
text
public
[1, 2, 3, 4, 5]
6
Expected Output:
text
True

Case 2

Input:
text
public
[1, 9, 10, 5, 8, 13]
26

Case 3

Input:
text
public
[1, 49, 29, 13, 95, 32, 10, 1, 5]
21
Expected Output:
text
False

Case 4

Input:
text
public
[1, 49, 29, 13, 95, 32, 10, 1, 5]
20

🔒 Private Tests ( 0/0 )

This test case group is locked and will be revealed after the deadline.


💻 IITM Official Solution

Solution code is currently locked and will be available after the deadline.

💻 My Submitted Code

python
def subset_sum(L, s):
    """
    A recursive function to determine the presence of a subset with sum s.

    Parameters:
        L: list of integers
        s: integer
    Return:
        result: bool
    """

Document Outline
Table of Contents
System Normal // Awaiting Context

Intelligence Hub

Navigate the knowledge graph to generate context. The Hub adapts dynamically to surface backlinks, related notes, and metadata insights.