fork download
  1. def f(bullet_mass, bullet_velocity):
  2. gun_mass = 1.0
  3. gun_velocity = bullet_mass / gun_mass * bullet_velocity
  4. bullet_energy = bullet_mass * bullet_velocity**2 / 2
  5. gun_energy = gun_mass * gun_velocity**2 / 2
  6. print bullet_velocity, gun_velocity
  7. print bullet_energy, gun_energy, bullet_energy + gun_energy
  8.  
  9. f(0.010, 300.0)
  10. print
  11. f(0.020, 211.1)
Success #stdin #stdout 0s 7736KB
stdin
Standard input is empty
stdout
300.0 3.0
450.0 4.5 454.5

211.1 4.222
445.6321 8.912642 454.544742