Most likely, it’s the way in which you are calling the function.
If you simply call it with option_A(), from the main script, then it should be fine. If you want it to return the text so that you can do something else with said, then have the last line as return txt.format(percentYTM) and then print(option_A()) (if you want to display the text) from the main script.
Oh sorry, my mistake.
I tried with print(option_()) but it’s still giving me ‘none’ and is no longer giving me the answer that was originally in the print statement.
I’m calling option_A from another function (the ‘menu’ of the code)
In terms of option_A itself, then I’m not calling it, I just want option_A to do the calculation and print the answer.
But the thing is, I can’t put print(option_A()) outside of the def option_A(): because then the code just begins with option_A() straight away instead of going through the menu.
You’ve nailed the function, so it seems to me that the ‘driver’ (the code that drives your app) needs to be looked into; your menu code and the likes of.
The code that is printing None is not the code you have shown us. You need to look at the “menu” code and see what it is doing, and why it is printing None.
Maybe all of the code would be overkill; we have one function and it seems to me that you know how to code, so just the driver code should do, if you’re still stuck.