用户:
飞熊jSrt查看:0 回复:0 评论:0 创建时间:2023-06-20T19:20:00
这个代码可以练习你的约分能力
import random as r
while 1:
p=[2, 3, 5, 7, 11, 13,15]
a=r.choice(p)
b=r.choice(p)
c=r.randint(1,12)
aws= ("%d/%d"%(a,b))
if r.random()<0.2:
b=r.choice(p)
d=r.randint(1,3)
a=b*d
aws=str(d)
if a==b:aws="1"
print("%d\n——\n%d\n="%(a*c,b*c),end="")
ipt=input()
if (ipt == aws):
print(" right!!really is %s!"%(aws))
else:
print(" is %s"%(aws))