def mul(*args):
if len(args) :
s = 1
for a in args:
if isinstance(a, (int ,float)):
s*=a
else:
raise TypeError('We need int or float.')
return s
else :
raise TypeError('there is no munber')
def move(n, a, b, c):
if not isinstance (n,(int or n <= 0 and n <-1)):
raise TypeError("'n' needs +int")
if n == 1:
print(a, '-->', c)
else :
move(n-1, a, c, b)
move(1, a, b, c)
move(n-1, b, a, c)
制
看楼下解决