How to Use Python for solving the following physics question

How to Use Python for solving the following physics question. Python Code and procedure required
A car of mass 1600kg moving with an initial velocity of 18ms-1 (ms power -1) hits another stationary car of mass 1400kg and they lock together. With what velocity do they move after an elastic collision?
Data Given;
m1=1600 kg
m2= 1400 kg
u1= 18 ms-1
u2= 0
v1=v2=v
to find v=?

Formula: m1u1+m2u2=m1v1+m2v2

Solution:
m1u1+m2u2=m1v1+m2v2
1600x18+1400x0=1600+1400v
28800+0=3000v
v=28800/3000
v=9.6 ms-1 Answer
A car of mass 1600kg moving with an initial velocity of 18ms-1 (ms power -1) hits another stationary car of mass 1400kg and they lock together. With what velocity do they move after an elastic collision?
Data Given;
m1=1600 kg
m2= 1400 kg
u1= 18 ms-1
u2= 0
v1=v2=v
to find v=?

Formula: m1u1+m2u2=m1v1+m2v2

Solution:
m1u1+m2u2=m1v1+m2v2
1600x18+1400x0=1600+1400v
28800+0=3000v
v=28800/3000
v=9.6 ms-1 Answer

Welcom, Imran.

I suggest you do the homework yourself. So, here are some starter hints:

# Use input() method to gather given information
#Example:
m1 = input() # After running the code, the executioner will ask for the value

# Use print() to show the steps and working:
print('Formula used: m1u1 + m2u2 = (m1 + m2)v1')

# print final answer:
print('v = ' + str(v1))

If your question is even more fundamental for how to use Python, read here:
w3schools - Python

Hope this helps.

1 Like