Here is my second part of an introduction to functions in python. In this example, I create a function to find the range of a projectile and then use that to find the angle that gives the maximum range.
Here is part 1:
• Python Functions for Mere Physicists
Here is the code:
https://trinket.io/glowscript/8ecd6ed139