Neural Sync Active
jan-2026-python-week-7-collections-4
Registry Synced
jan-2026-python-week-7-collections-4
629 words
3 min read
Collections 4
Course: Jan 2026 - Python
Collections 4
Submission deadline has passed for this assignment
Due Apr 01, 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 Apr 01, 2026 at 3:50 AM IST
Private Tests
2/2 Passed
Submitted on Apr 01, 2026 at 3:50 AM 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.
Find final position in 2d given initial position and velocity**
Given an initial position of a point moving in a 2d cartesian plane with a constant velocity, find the the final position of the point after a given time in two dimensions.
Hint: final position = intial position + velocity * time
Template Code(Click to Expand)
def final_position(pos: tuple, vel: tuple, time:int) -> tuple: ''' Given an initial position of a point moving in a cartesian plane with a constant velocity, find the the final position of the point after a given time. Hint: final position = intial position + velocity * time Args: pos - tuple[int]: A tuple representing the position vector (x1, y1). vel - tuple[int]: A tuple representing the velocity vector (vx, vy). time - int: time of movement. Returns: tuple[int]: A tuple representing the displacement (dx, dy). ''' ...
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(final_position((1,1), (2,2), 3), (7,7))
Case 1
Expected Output:
text(7, 7)
Case 1
Actual Output:
text(7, 7)
Case 2
Input:
textis_equal(final_position((1,2), (2,1), 3), (7,5))
Case 2
Expected Output:
text(7, 5)
Case 2
Actual Output:
text(7, 5)
Case 3
Input:
textis_equal(final_position((1,1), (1,1), 2), (3,3))
Case 3
Expected Output:
text(3, 3)
Case 3
Actual Output:
text(3, 3)
Private Tests ( 2/2 )
Case 1
Input:
textis_equal(final_position((-1,1), (4,4), 3), (11,13))
Case 1
Expected Output:
text(11, 13)
Case 1
Actual Output:
text(11, 13)
Case 2
Input:
textis_equal(final_position((2,2), (8,2), 0), (2,2)) is_equal(final_position((1,-4), (1,4), 2), (3,4))
Case 2
Expected Output:
text(2, 2) (3, 4)
Case 2
Actual Output:
text(2, 2) (3, 4)
💻 IITM Official Solution
pythondef final_position(pos: tuple, vel: tuple, time:int) -> tuple: ''' Given an initial position of a point moving in a cartesian plane with a constant velocity, find the the final position of the point after a given time. Hint: final position = intial position + velocity * time Args: pos - tuple[int]: A tuple representing the position vector (x1, y1). vel - tuple[int]: A tuple representing the velocity vector (vx, vy). time - int: time of movement. Returns: tuple[int]: A tuple representing the displacement (dx, dy). ''' x1, y1 = pos vx, vy = vel return (x1+vx*time , y1+vy*time)
💻 My Submitted Code
pythondef final_position(pos: tuple, vel: tuple, time: int) -> tuple: # 1. Unpack the coordinates and velocities x, y = pos vx, vy = vel # 2. Apply the formula: final = initial + (velocity * time) xf = x + (vx * time) yf = y + (vy * time) return (xf, yf)