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

2024-05-16 15:39:31 发布

您现在位置:Python中文网/ 问答频道 /正文

代码:

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。你知道吗


Tags: theto代码importinputvalueloadint