Hey folks, this article features NPTEL Joy Of Computing Using Python Week 11 Programming Assignment 2025 answers with passed test cases. The previous articles discuss about week 10 programming assignment which passed all the test cases given.Â
If you didn't complete the Week 10 Assignment of Joy of Computing using Python programming, the link is given below.Â
Also Read:Â NPTEL Joy Of Computing Using Python Week 10 Programming Assignment 2025
Upcoming answers are provided in Telegram faster
Join us on Telegram 👉 CLICK HERE Â
NPTEL Joy Of Computing Using Python Week 11 Programming Assignment 2025
In this week, the following topics are discussed:Â
- Browser Automation with watsapp using Python
- Fun with Calender
Last Date: 10-04-2025
Q1. You are given a list of n distinct integers in the range [0, n] (inclusive). This means exactly one number from this range is missing. Your task is to determine and return the missing number.
Input: A list nums containing n distinct integers from 0 to n.
Output: The missing integer in the range [0, n]
Examples:
Input: nums = [0, 2, 3, 1, 4]
Output: 5
The list contains {0, 1, 2, 3, 4}, so 5 is missing.
Input: nums = [0, 1, 2, 4, 5, 6]
Output: 3
The list contains {0, 1, 2, 4, 5, 6}, so 3 is missing.
Program Code:Â
def missingNumber(nums):Â n = len(nums)ÂÂ expected_sum = n * (n + 1) // 2Â actual_sum = sum(nums)Â return expected_sum - actual_sum {codeBox}
 Â
Q2. Given a list of integers nums and an integer k, write a Python function to check whether there exists a subsequence (a non-contiguous subset of the list) such that the sum of its elements equals k. Return True if such a subsequence exists, otherwise False.
Example 1 :
Input:
nums = [1, 2, 3, 4, 5]
k = 8
Output:
True
Example 2 :Â
Input:
nums = [4, 3, 9, 2]
k = 10
Output:
False
ConstraintsÂ
- 1<=len(nums)<=20
- 1<=nums[i]<=100
- 1<=k<=2000
Program Code:
def checkSubsequenceSum(nums, k, i=0):  if k == 0:   return True  Â  if i >= len(nums):    return False  Â  include = checkSubsequenceSum(nums, k - nums[i], i + 1)  exclude = checkSubsequenceSum(nums, k, i + 1)  return include or exclude {codeBox}
Q3. Given a string s representing a large integer, return the largest-valued odd integer (as a string) that is a substring of s.
Note:
- The result should not contain any leading zeros.
- The input string s may contain leading zeros.
Constraints :
1 <= s.length <= 10^3
'0' <= s[i] <= '9'
Example 1:
Input:
s = "5347"
Output:
"5347"
Explanation:
All possible odd numbers: {5, 3, 53, 347, 5347}
The largest odd number is "5347".
Example 2:
Input:
s = "0214638"
Output:
"21463"
Explanation:
Valid odd numbers: {1, 3, 21, 63, 463, 1463, 21463}
Leading zeros cannot be included.
The largest odd number is "21463".
Example 3:
Input:
s = "0032579"
Output:
"32579"
Program Code:Â
import astdef largeOddNum(s):Â Â s = s.strip('"')Â ÂÂ Â for i in range(len(s) - 1, -1, -1):Â Â Â Â if s[i].isdigit() and int(s[i]) % 2 == 1:Â ÂÂ Â Â Â Â Â return s.lstrip('0')[:i+1]Â ÂÂ Â return ""Âinput_str = input().strip()print(f'"{largeOddNum(input_str)}"', end='') {codeBox}
Conclusion
If you get any error in the code or are unable to paste join us in telegram and we solve your doubts