为什么Python中的语法错误无效?

时间:2016-04-26 16:03:02

标签: python

import math
# Program intro
def main():
# float print functions for n, A, r

n = float(input('How much time in years do you need to pay back the loan?'))
A = float(input("What is the amount of money you would like to borrow in whole dollars $?"))
r = float(input("What is your desired interest rate in a whole number?"
P = (r + A) / (n * A)

为什么P =(r + A)/(n * A)是一个SyntaxError:语法无效

1 个答案:

答案 0 :(得分:4)

r = float(input("What is your desired interest rate in a whole number?"
                                                                      ^
                                                      Missing 2 parenthesis

正确的行看起来像:

r = float(input("What is your desired interest rate in a whole number?"))