main() 是无效语法?

main() is an invalid syntax?

我使用 main() 来 运行 程序,但它一直称其为无效语法。甚至调试器似乎也无法弄清它的正反面。这是我的全部代码。

     """

  InvestmentCalculator.py helps generate how much interest one earns after a certain period of time
 """


 def main():
     total_money = 0
     months_invested = 0
     years_investment = 0

 investment = float(input("How much would you like to invest? "))
 years_investment = float(input("How many years would you like to invest? "))
 interest_rate = float(input("What is the interest rate? "))
 total_money = float()

 months_invested = years_investment / 12
 while months_invested > 0:
     total_money = investment +  total_money
     months_invested = months_invested - 1
     print("You have earned ${:,.2f}".format(total_money))
 else: print("You've earned a total of ${:,.2f}".format(total_money)



 main()

这是一个语法错误。您错过了 print 语句 line: 18

的括号