版權聲明:本文爲博主原創文章,未經博主允許不得轉載。 https://blog.csdn.net/Magicfrogman/article/details/52476414
兒子的數學題
2 2 2 =6
3 3 3 =6
4 4 4=6
.
.
.
9 9 9 =6
要求是填上符號,等式成立。好吧,我又偷懶了。
for i in map(str,range(1,11)):
for j in range(10000):
c=random.choice(["+","-","*","/","**0.5",""])
b=random.choice(["+","-","*","/","**0.5",""])
e=random.choice(["**0.5",""])
if c=="**0.5":
c=c+random.choice(["+","-","*","/"])
if b=="**0.5":
b=b+random.choice(["+","-","*","/"])
if eval(i+c+i+b+i+e)==6:
print i+c+i+b+i
break