Write Your invest() Function
00:00
Now let’s tackle the invest()
function part. We need a function named invest()
with three parameters.
00:09
So for now, let’s not focus so much on the content of the function, but the function definition. Underneath this comment, you can write def
, invest(amount, rate, years):
Next line, you can just add a pass
because we’ll tackle this in a moment.
00:31
And of course, it should be invest
, not investe
as the function name. And that’s basically that part of the challenge done as well.
00:40
We wrote a function called invest()
with three parameters: the principal amount, yearly rate, and the amount of years.
00:47
By adding pass
in the function body, then the function basically does nothing. But I really like to boil down different parts of a bigger challenge into smaller bits.
00:59 So with this, you now have the function, and the next part can be to add in the content to the function body.
Become a Member to join the conversation.