def isValid(s1,s2,s3): if s1 + s2 > s3 and s1 + s3 > s2 and s2 + s3 > s1: print("三边合规") return True else: print("三边不合规") return False def area(s1,s2,s3): if isValid(s1, s2, s3): p = (s1 + s2 + s3)/2 a = (p * (p - s1)*(p - s2)*(p - s3))**0.5 print(f"三角形的面积{a}") return a else: print("三边不合构成三角形的规则") area(s1=3,s2=4,s3=5)
def reverse(number): str_number = str(number) reversed_str_number = str_number[::-1] reversed_number = int(reversed_str_number) return reversed_number if __name__ == "__main__": try: input_number = int(input("请输入一个整数:")) print("反向显示的整数是:", reverse(input_number)) except ValueError: print("输入错误,请确保您输入的是一个整数。")