← Back to challenges

Javelin Parabolic Throw

PythonHardphysicsmath

Instructions

Write a function that takes initial speed (v in m/s) and throw angle (a in degrees) and returns the maximum height and maximum range reached by javelin as a string.

Examples

javelin_throw(36.7, 45) ➞ "Ymax=34m, Xmax=137m"

javelin_throw(51.3, 20) ➞ "Ymax=16m, Xmax=172m"

javelin_throw(100.1, 89) ➞ "Ymax=511m, Xmax=36m"

Notes

  • Javelin starts moving at h=0m.
  • Gravitational acceleration is g=9.81 m/s^2.
  • All results should be rounded to the nearest whole number.
python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.