Define the Investment Variables
00:00 Well, I was just saying that the next task could be to add the content to the function body, but looking at the tasks that you need to do can also be a good idea to first define the variables that you pass into the function.
00:15 And just like before, it’s also a good idea to not prompt the user immediately, but to work with fixed values that you add into your source code and prompt the user later because this makes testing and developing your code way less cumbersome.
00:32
So the part that you’ll tackle now is calling the invest(0
function and display of values. So add the variable amount
that equals 100
just like in our example before, the variable rate
and set it to 5 percent or 0.05
, and the variable years
which you set to 4
.
00:57 And again, we can prompt the user about those values later. It’s a good idea to add a to-do there so we don’t forget about it. But for now, we call the function with those values that you add into the source code.
01:10
So in the last line, you can call invest()
with amount
, rate
, and years
.
01:16
And when you save and run the module, nothing happens because we have the pass
inside the function body. So in line 4 inside the function body, you can add a print()
function call again with amount
, rate
, and years
.
01:32 And now if you run the module, then you can see those values printed out, which for now is exactly what you want to do. Again, it’s a smaller part of the challenge, but you are making progress bit by bit.
Become a Member to join the conversation.