for A in range(1,10): for B in range(0,10):
for C in range(0,10):
for D in range(1,10):
start = 1000*A+100*B+10*C+D
end = 1000*D+100*C+10*B+A
if start * 9 == end:
print("A={}".format(A))
print("B={}".format(B))
print("C={}".format(C))
print("D={}".format(D))
print("{0} * 9 = {1}".format(start,end))
def one(n): total = 1
if n ==0:
total = 1
else:
for i in range(1,n+1):
total *= i
return total
print(one(3))
status=1
while status:
result = 0
n= input("Please input a number(n>=0) : ")
for i in n:
if not i.isdigit():
print("The number of you input is error.")
exit(1)
if int(n) < 0:
print("The number of you input is error.")
break
for i in range(0,int(n)+1):
result += one(i)
print("0! + 1! + 2! + ··· ··· + n! = {}".format(result))