class Factorial: def fact(self,num): if num > 0: return num*self.fact(num-1) else: return 1 num = float(input('输入要求的阶乘:')) a = Factorial() ret = a.fact(num) print(ret)