title: Bad input parse error?
body: <p>I'm trying to write a program that will help me crunch some numbers for my physics homework. The program itself became lengthy and I only know the basics of Python so I'm sure many things could have been done easier. My problem is that when I try to run the program, it tells me there is an error in line 133, but I cannot figure out what's wrong in the code.</p>
  
  <pre><code>def initial_momentum_cm_2(m2, m2U, Vcmi2, Vcmi2U, Vcm, VcmU, Vi2, Vi2U, Pi1, Pi1U, Pi2, Pi2U, m1, m1U):
      Pcmi2 = Vcmi2*m2
      Pcmi2U = (((Vi1U+(((Pi1U+Pi2U)/(Pi1+Pi2))+((m1U+m2U))+(m2U/m2))*Pcmi2
      return Pcmi2, Pcmi2U
  intitial_momentum_cm_2 = initial_momentum_cm_2(m2, m2U, Vcmi2, Vcmi2U, Vcm, VcmU, Vi2, Vi2U, Pi1, Pi1U, Pi2, Pi2U, m1, m1U)
  </code></pre>
  
  <p>Line 133 is <code>Pcmi2U = (((Vi1U+(((Pi1U+Pi2U)/(Pi1+Pi2))+((m1U+m2U))+(m2U/m2))*Pcmi2</code>
  However, I believe that this entire block is correct. Help please, and thanks.</p>
  
  <pre><code>print "results given in (value, uncertainty) form"
  print "cmf refers to center of mass reference frame"
  w = float(raw_input("Enter width of index card (m))"))
  wU = float(raw_input("Enter uncertainty of index card"))
  m1 = float(raw_input("Enter mass of cart 1 (red) (g)"))
  m1U = float(raw_input("Enter uncertainty of m1"))
  Vi1 = float(raw_input("Enter initial velocity of cart 1 (m/s):"))
  Vi1U = float(raw_input("Enter uncertainty of Vi1"))
  Vf1 = float(raw_input("Enter final velocity of cart 1 (m/s):"))
  Vf1U = float(raw_input("Enter uncertainty of Vf1"))
  m2 = float(raw_input("Enter mass of cart 2 (blue) (g):"))
  m2U = float(raw_input("Enter uncertainty of m2"))
  Vi2 = float(raw_input("Enter initial velocity of cart 2 (m/s)"))
  Vi2U = float(raw_input("Enter uncertainty of Vi2"))
  Vf2 = float(raw_input("Enter final velocity of cart 2 (m/s):"))
  Vf2U = float(raw_input("Enter uncertainty of Vf2"))
  wRU = wU/w 
  #RU=Relative Uncertainty
  print ("width uncertainty:"), wRU,("m")
  
  #Fix 1: Added "global" command in order to be able to access
  # a variable inside a funtion.
  
  
  #Initial and final momenta of each mass in lab reference frame
  def initial_momentum_1(m1, m1U, Vi1, Vi1U):
      global Pi1
      global Pi1U
      Pi1 = m1*Vi1
      Pi1U = Pi1*wRU
      return Pi1, Pi1U
  initial_momentum_1 = initial_momentum_1(m1, m1U, Vi1, Vi1U)
  
  def final_momentum_1(m1, m1U, Vf1, Vf1U):
      global Pf1
      global Pf1U
      Pf1 = m1*Vf1
      Pf1U = Pf1*wRU
      return Pf1, Pf1U
  final_momentum_1 = final_momentum_1(m1, m1U, Vf1, Vf1U)
  
  def initial_momentum_2(m2, m2U, Vi2, Vi2U):
      global Pi2
      global Pi2U
      Pi2 = m2*Vi2
      Pi2U = Pi2*wRU
      return Pi2, Pi2U
  initial_momentum_2 = initial_momentum_2(m2, m2U, Vi2, Vi2U)
  
  def final_momentum_2(m2, m2U, Vf2, Vf2U):
      global Pf2
      global Pf2U
      Pf2 = m2*Vf2
      Pf2U = Pf2*wRU
      return Pf2, Pf2U
  final_momentum_2 = final_momentum_2(m2, m2U, Vf2, Vf2U)
  
  print "Initial momentum 1:",initial_momentum_1,"nMs"
  print "Final momentum 1:",final_momentum_1,"nMs"
  print "Initial momentum 2:",initial_momentum_2,"nMs"
  print "Final momentum 2:",final_momentum_2,"nMs"
  
  
  
  #Velocity of center of mass in lab reference frame
  def Velocity_Center_of_Mass(Pi1, Pi1U, Pi2, Pi2U, m1, m1U, m2, m2U):
      global Vcm
      global VcmU
      Vcm = (Pi1+Pi2)/(m1+m2)
      VcmU = (((Pi1U+Pi2U)/(Pi1+Pi2))+((m1U+m2U)/(m1+m2)))*Vcm
      return Vcm, VcmU
  Velocity_Center_of_Mass = Velocity_Center_of_Mass(Pi1, Pi1U, Pi2, Pi2U, m1, m1U, m2, m2U)
  
  print "Velocity of center of mass:",Velocity_Center_of_Mass,"m/s"
  
  
  
  #Initial and final velocities of each mass in center-of-mass reference frame
  def Vcmi1(Vcm, VcmU, Vi1, Vi1U, Pi1, Pi1U, Pi2, Pi2U, m1, m1U, m2, m2U):
      global Vcmi1
      global Vcmi1U
      Vcmi1 = Vi1-Vcm
      Vcmi1U = (Vi1U+(((Pi1U+Pi2U)/(Pi1+Pi2))+((m1U+m2U)/(m1+m2))))*Vcmi1
      return Vcmi1, Vcmi1U
  Vcmi1 = Vcmi1(Vcm, VcmU, Vi1, Vi1U, Pi1, Pi1U, Pi2, Pi2U, m1, m1U, m2, m2U)
  
  def Vcmf1(Vcm, VcmU, Vf1, Vf1U, Pi1, Pi1U, Pi2, Pi2U, m1, m1U, m2, m2U):
      global Vcmf1
      global Vcmf1U
      Vcmf1 = Vf1-Vcm
      Vcmf1U = (Vi1U+(((Pi1U+Pi2U)/(Pi1+Pi2))+((m1U+m2U)/(m1+m2))))*Vcmf1
      return Vcmf1, Vcmf1U
  Vcmf1 = Vcmf1(Vcm, VcmU, Vf1, Vf1U, Pi1, Pi1U, Pi2, Pi2U, m1, m1U, m2, m2U)
  
  def Vcmi2(Vcm, VcmU, Vi2, Vi2U, Pi1, Pi1U, Pi2, Pi2U, m1, m1U, m2, m2U):
      global Vcmi2
      global Vcmi2U
      Vcmi2 = Vi2-Vcm
      Vcmi2U = (Vi1U+(((Pi1U+Pi2U)/(Pi1+Pi2))+((m1U+m2U)/(m1+m2))))*Vcmi2
      return Vcmi2, Vcmi2U
  Vcmi2 = Vcmi2(Vcm, VcmU, Vi2, Vi2U, Pi1, Pi1U, Pi2, Pi2U, m1, m1U, m2, m2U)
  
  def Vcmf2(Vcm, VcmU, Vf2, Vf2U, Pi1, Pi1U, Pi2, Pi2U, m1, m1U, m2, m2U):
      global Vcmf2
      global Vcmf2U
      Vcmf2 = Vf2-Vcm
      Vcmf2U = (Vi1U+(((Pi1U+Pi2U)/(Pi1+Pi2))+((m1U+m2U)/(m1+m2))))*Vcmf2
      return Vcmf2, Vcmf2U
  Vcmf2 = Vcmf2(Vcm, VcmU, Vf2, Vf2U, Pi1, Pi1U, Pi2, Pi2U, m1, m1U, m2, m2U)
  
  print "Initial velocity 1 in cmf:",Vcmi1,"m/s"
  print "Final velocity 1 in cmf:",Vcmf1,"m/s"
  print "Initial velocity 2 in cmf:",Vcmi2,"m/s"
  print "Final velocity 2 in cmf:",Vcmf2,"m/s"
  
  
  #Initial and final momenta of each mass in center-of-mass frame
  def initial_momentum_cm_1(m1, m1U, Vcmi1, Vcmi1U, Vcm, VcmU, Vf2, Vf2U, Pi1,      Pi1U, Pi2, Pi2U, m2, m2U):
      Pcmi1 = Vcmi1*m1
      Pcmi1U = (((Vi1U+(((Pi1U+Pi2U)/(Pi1+Pi2))+((m1U+m2U)/(m1+m2)))))+    (m1U/m1))*Pcmi1
      return Pcmi1, Pcmi1U
  initial_momentum_cm_1 = initial_momentum_cm_1(m1, m1U, Vcmi1, Vcmi1U, Vcm,     VcmU, Vf2, Vf2U, Pi1, Pi1U, Pi2, Pi2U, m2, m2U)
  
  def final_momentum_cm_1(m1, m1U, Vcmf1, Vcmf1U, Vcm, VcmU, Vf1, Vf1U, Pi1, Pi1U, Pi2, Pi2U, m2, m2U):
      Pcmf1 = Vcmf1*m1
      Pcmf1U = (((Vi1U+(((Pi1U+Pi2U)/(Pi1+Pi2))+((m1U+m2U)/(m1+m2)))))+(m1U/m1))*Pcmf1
      return Pcmf1, Pcmf1U
  final_momentum_cm_1 = final_momentum_cm_1(m1, m1U, Vcmf1, Vcmf1U, Vcm, VcmU, Vf1, Vf1U, Pi1, Pi1U, Pi2, Pi2U, m2, m2U)
  
  def initial_momentum_cm_2(m2, m2U, Vcmi2, Vcmi2U, Vcm, VcmU, Vi2, Vi2U, Pi1,   Pi1U, Pi2, Pi2U, m1, m1U):
      Pcmi2 = Vcmi2*m2
      Pcmi2U = Vi1U+(((Pi1U+Pi2U)/(Pi1+Pi2))+((m1U+m2U))+(m2U/m2))*Pcmi2
      return Pcmi2, Pcmi2U
  intitial_momentum_cm_2 = initial_momentum_cm_2(m2, m2U, Vcmi2, Vcmi2U, Vcm, VcmU, Vi2, Vi2U, Pi1, Pi1U, Pi2, Pi2U, m1, m1U)
  
  def final_momentum_cm_2(m2, m2U, Vcmf2, Vcmf2U,Vcm, VcmU, Vf2, Vf2U, Pi1,     Pi1U, Pi2, Pi2U, m1, m1U):
      Pcmf2 = Vcmf2*m2
      Pcmf2U = (((Vi1U+(((Pi1U+Pi2U)/(Pi1+Pi2))+((m1U+m2U)/(m1+m2)))))+(m2U/m2))*Pcmf2
      return Pcmf2, Pcmf2U
  final_momentum_cm_2 = final_momentum_cm_2(m2, m2U, Vcmf2, Vcmf2U,Vcm, VcmU, Vf2, Vf2U, Pi1, Pi1U, Pi2, Pi2U, m1, m1U)
  
  print "Initial momentum 1 in cmf:", initial_momentum_cm_1, "nMs"
  print "Final momentum 1 in cmf:",final_momentum_cm_1,"nMs"
  print "Initial momentum 2 in cmf:",intitial_momentum_cm_2,"nMs"
  print "Final momentum 2 in cmf:",final_momentum_cm_2,"nMs"
  
  
  
  #Momentum of center of mass in center-of-mass reference frame
  def momentum_center_of_mass(m1, m1U, m2, m2U, Vcm, VcmU):
      Pcm = (m1+m2)*Vcm
      PcmU = (((m1U+m2U)/(m1_m2))+(VcmU/Vcm))*Pcm
      return Pcm, PcmU
  momentum_center_of_mass = momentum_center_of_mass(m1, m1U, m2, m2U, Vcm, VcmU)
  
  print "Momentum of center of mass in cmf:",momentum_center_of_mass,"nMs"
  </code></pre>