Why does my code not return anything

后端 未结 5 1629
终归单人心
终归单人心 2021-01-29 16:28

fairly new to programming and trying to learn Python at the moment. I have this code and I don\'t understand why I don\'t get a return value :(

balance = 3200
an         


        
5条回答
  •  情书的邮戳
    2021-01-29 17:17

    First you should add return ba to function f to make f return someting:

    def f(x):
        m = 0
        ba = balance 
        while m < 12: 
            ba = (ba - x)*monthlyInterestRate 
            m += 1
        retrun ba
    

    Then, add bisection() at the last of your script file to call it:

    bisection()
    

提交回复
热议问题