我正在做我的作业,结果出现了一些问题,我想在我的函数中返回“真”或“假”,但最后什么也没有显示。
import math
import decimal
#1
def pythagorean_pair():
a = input("Type a number A(Must be an integer): ")
if a.isdigit():
a=int(a)
b = input("Type a number B(Must be an integer): ")
if b.isdigit():
b = int(b)
c = a**2 + b**2
ans = c**(1/2)
ans = ans - int(ans)
if ans == 0:
return (True)
print ("True, they are pythagorean pair!")
else:
return (False)
print ("False, they are not pythagorean pair!")
else:
print ("Please input an integer!!")
else:
print ("Please input an integer!!")
pythagorean_pair()