Home

Learn Programming & Prepare for NPTEL Exams... Swayam Solver is your one-stop destination for NPTEL exam preparation.

NPTEL The Joy of Computing using Python July - 2025 | Swayam

 

NPTEL » The Joy of Computing using Python


  Please scroll down for latest Programs ðŸ‘‡ 



Week 2 - Programming Assignment 1

Due on 2025-08-07, 23:59 IST
Gautam Gambhir, freshly appointed head coach for India’s 2025 away Test series against England, has asked the new analyst, Aryan, to keep a quirky statistic:
“At the end of each day’s play,” Gambhir says, “tell me the total runs we scored in every odd-numbered over—1st, 3rd, 5th … all the way up to the last over bowled that day. It helps me spot momentum in the sessions where bowlers are freshest.”
Aryan realises the job boils down to simple maths: if n is the last over of the day (always a positive integer), he just needs the sum of all odd integers from 1 through n.
Your task is to step into Aryan’s shoes and automate this little ritual.
Input Format:
A single integer
Output Format:
A single integer: the sum of all odd numbers from 1 to n
Your last recorded submission was on 2025-08-02, 19:39 IST
Select the Language for this assignment. 
1
n = int(input())
2
total = 0
3
for i in range(1, n + 1, 2):
4
    total += i
5
print(total)
You may submit any number of times before the due date. The final submission will be considered for grading.
This assignment has Public Test cases. Please click on "Compile & Run" button to see the status of Public test cases. Assignment will be evaluated only after submitting using Submit button below. If you only save as or compile and run the Program , your assignment will not be graded and you will not see your score after the deadline.
   


 
 
Public Test CasesInputExpected OutputActual OutputStatus
Test Case 1
1
1
1\n
Passed after ignoring Presentation Error
Test Case 2
2
1
1\n
Passed after ignoring Presentation Error
Test Case 3
10
25
25\n
Passed after ignoring Presentation Error



Week 2 - Programming Assignment 2

Due on 2025-08-07, 23:59 IST
A high-security vault uses a custom PIN authentication mechanism. To reduce the chances of brute-force attacks, the system only allows PINs that are Neon Numbers.
The rule is:
A PIN is valid if the sum of the digits of its square equals the PIN itself.
Your Task: Write a Python program that reads a numeric PIN input by the user and validates whether it is a Neon Number or not.
Your last recorded submission was on 2025-08-02, 19:41 IST
Select the Language for this assignment. 
1
pin = int(input())
2
square = pin ** 2
3
digit_sum = sum(int(digit) for digit in str(square))
4
if digit_sum == pin:
5
    print("Neon Number")
6
else:
7
    print("Not Neon Number")
You may submit any number of times before the due date. The final submission will be considered for grading.
This assignment has Public Test cases. Please click on "Compile & Run" button to see the status of Public test cases. Assignment will be evaluated only after submitting using Submit button below. If you only save as or compile and run the Program , your assignment will not be graded and you will not see your score after the deadline.
   


 
 
Public Test CasesInputExpected OutputActual OutputStatus
Test Case 1
0
Neon Number
Neon Number\n
Passed after ignoring Presentation Error
Test Case 2
1
Neon Number
Neon Number\n
Passed after ignoring Presentation Error
Test Case 3
2
Not Neon Number
Not Neon Number\n
Passed after ignoring Presentation Error



Week 2 - Programming Assignment 3

Due on 2025-08-07, 23:59 IST
While analysing intercepted communications, TASC officer Srikant Tiwari suspects that some messages might be carrying hidden signals. One of the red flags used by the agency is the density of vowels in a message — unusually high vowel counts may indicate a coded alert.
To assist in screening these messages quickly, a script is needed to count the number of vowels in any given string.
Write a Python program that:
Takes a message as input.
Counts the number of vowels (a, e, i, o, u — both uppercase and lowercase).
Prints the vowel count.
Input Format:
A single line containing a string .
Output Format:
A single integer — the count of vowels (A, E, I, O, U in both uppercase and lowercase).
Your last recorded submission was on 2025-08-02, 19:43 IST
Select the Language for this assignment. 
1
message = input()
2
vowels = "aeiouAEIOU"
3
count = 0
4
for char in message:
5
    if char in vowels:
6
        count += 1
7
print(count)
You may submit any number of times before the due date. The final submission will be considered for grading.
This assignment has Public Test cases. Please click on "Compile & Run" button to see the status of Public test cases. Assignment will be evaluated only after submitting using Submit button below. If you only save as or compile and run the Program , your assignment will not be graded and you will not see your score after the deadline.
   


 
 
Public Test CasesInputExpected OutputActual OutputStatus
Test Case 1
hello
2
2\n
Passed after ignoring Presentation Error
Test Case 2
PYTHON
1
1\n
Passed after ignoring Presentation Error
Test Case 3
OpenAI 123
4
4\n
Passed after ignoring Presentation Error






















































































































No comments:

Post a Comment

Keep your comments reader friendly. Be civil and respectful. No self-promotion or spam. Stick to the topic. Questions welcome.