
Lv.1
小说爱好者,同时也写过歌
在 TypeError: start must be a integer on line 18 咋办 中回复
import math
import turtle
import time
import random
__Pen = turtle.Pen()
def factorial_sum_of_m_to_n(m,n):
global a, b, t
a, b, t = m, n, 0
int(a)
int(b)
int(t)
if (a % 1 == 0 and b % 1 == 0):
if (a < b):
for __count in range(((b - a) + 1)):
t += (math.factorial(a))
a += 1
elif (a > b):
for __count in range(((a - b) + 1)):
t += (math.factorial(a))
a += 1
else:
t += (math.factorial(a))
else:
while (not (a % 1 == 0 and b % 1 == 0)):
factorial_sum_of_m_to_n(turtle.numinput('阶乘和', '请输入第一个数字', 3, 3, 36), turtle.numinput('阶乘和', '请输入第二个数字', 3, 3, 36))
factorial_sum_of_m_to_n(turtle.numinput('阶乘和', '请输入第一个数字', 3, 3, 36), turtle.numinput('阶乘和', '请输入第二个数字', 3, 3, 36))
__Pen.circle(30, steps=t)
time.sleep(0.5)
print(t)
2021-08-19T15:43:10 点赞:0