Neural Sync Active
Jan 2026 - Python - Week 6 - Numbers 3 - Graded
Registry Synced
Jan 2026 - Python - Week 6 - Numbers 3 - Graded
627 words
3 min read
Graded Assignment
Course: Jan 2026 - Python
Numbers 3 - Graded
Submission deadline has passed for this assignment
Due Mar 25, 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
100 out of100
Score
Public Tests
3/3 Passed
Submitted on Mar 25, 2026 at 2:25 PM IST
Private Tests
3/3 Passed
Submitted on Mar 25, 2026 at 2:25 PM IST
Change in eligibility criteria to write oppe2 exam: A5>=40/100 AND A6>=40/100 AND A7>=40/100 AND A8>=40/100. and becoming eligible to give the end term exam.
Arithmetic Operations tuple from two integers
Given a tuple of two integers (a, b), return a tuple containing the sum, difference, product, and quotient (integer division) of the two numbers.
Example:
>>> arithmetic_operations((1, 2)) (3, -1, 2, 0)
Template Code(Click to Expand)
def arithmetic_operations(t: tuple) -> tuple: ''' Given a tuple of two integers (a, b), return a tuple containing the sum, difference, product, and quotient (integer division) of the two numbers. Arguments: t: tuple - a tuple of two integers (a, b) Return: tuple - a tuple containing the sum, difference, product, and quotient Example: >>> arithmetic_operations((1, 2)) (3, -1, 2, 0) ''' ...
NOTE: You can use the below tools for working out and debugging. Click to open them in new tab.
Public Tests ( 3/3 )
Case 1
Input:
textis_equal( arithmetic_operations((1, 2)), (3, -1, 2, 0) )
Expected Output:
text(3, -1, 2, 0)
Actual Output:
text(3, -1, 2, 0)
Case 2
Input:
textis_equal( arithmetic_operations((10, 5)), (15, 5, 50, 2) )
Expected Output:
text(15, 5, 50, 2)
Actual Output:
text(15, 5, 50, 2)
Case 3
Input:
textis_equal( arithmetic_operations((-1,1)), (0, -2, -1, -1) )
Expected Output:
text(0, -2, -1, -1)
Actual Output:
text(0, -2, -1, -1)
Private Tests ( 3/3 )
Case 1
Input:
textis_equal( arithmetic_operations((-1, -2)), (-3, 1, 2, 0) )
Expected Output:
text(-3, 1, 2, 0)
Actual Output:
text(-3, 1, 2, 0)
Case 2
Input:
textis_equal( arithmetic_operations((-10, 5)), (-5, -15, -50, -2) )
Expected Output:
text(-5, -15, -50, -2)
Actual Output:
text(-5, -15, -50, -2)
Case 3
Input:
textis_equal( arithmetic_operations((0, 1)), (1, -1, 0, 0) )
Expected Output:
text(1, -1, 0, 0)
Actual Output:
text(1, -1, 0, 0)
💻 IITM Official Solution
pythondef arithmetic_operations(t: tuple) -> tuple: ''' Given a tuple of two integers (a, b), return a tuple containing the sum, difference, product, and quotient (integer division) of the two numbers. Arguments: t: tuple - a tuple of two integers (a, b) Return: tuple - a tuple containing the sum, difference, product, and quotient Example: >>> arithmetic_operations((1, 2)) (3, -1, 2, 0) ''' a, b = t return (a+b, a-b, a*b, a//b)
💻 My Submitted Code
pythondef arithmetic_operations(t: tuple) -> tuple: ''' Given a tuple of two integers (a, b), return a tuple containing the sum, difference, product, and quotient (integer division) of the two numbers. Arguments: t: tuple - a tuple of two integers (a, b) Return: tuple - a tuple containing the sum, difference, product, and quotient Example: >>> arithmetic_operations((1, 2)) (3, -1, 2, 0) ''' ... a, b = t sum_val = a+b diff_val = a-b prod_val = a*b quot_val = a // b return (sum_val,diff_val,prod_val,quot_val)