在绝对值计算器中接收意外的语法错误

时间:2013-08-09 18:47:44

标签: python cmath

代码:

print ("Welcome to my Calculator")
print ("Calculators: Absolute Value [av]")

load = int(input("Enter the calculator code here: "))

if load == av:

 import cmath

 import math

 avnum2 = int(input("Enter the number to have it's absolute value found: ")

 **avsol** = cmath.fabs (avnum2)

 print ("The solution (absolute value) is: ", avsol)

avsol上有语法错误,是的,我导入了cmath。

1 个答案:

答案 0 :(得分:4)

avnum2 = int(input("Enter the number to have it's absolute value found: ")
                                                                          ^

你错过了这一行的结束)