Firstly, note our homework policy FAQ: Homework Policy.
Be sure to tag a homework question with homework
(how? FAQ: How do I edit my topic or reply?), and be sure to not quote your homework verbatim.
A good way to start approaching this question would be to write out the equation for par_value
giving bond_value
and other parameters (I think that's coupon rate, ttm
is time to maturity and y is yield.
It looks like you're maybe taking Ang's datacamp course? The chapter 1 slides walk through this process to create the bond_value function.