Two Digits

Two Digits

Not enough ratings
A python program to solve the puzzles.一个用来解决谜题的python程序
By dreamness
A python program to solve the puzzles.
一个用来解决谜题的python程序。
   
Award
Favorite
Favorited
Unfavorite
code
#Because of some reason, the indentations are invisible on steam, please add them
#在Steam里显示不了缩进,自行对照图片添加吧
import itertools
while True:
num = [int(i) for i in list(input().split(' '))]
a = ['0', '1', '2']
b = 9
results = [''.join(x) for x in itertools.product(*[a] * b)]
for result in results:
green_sum = 0
orange_sum = 0
for i in range(0, 9):
if result == '0':
pass
elif result == '1':
green_sum = green_sum + num
elif result == '2':
orange_sum = orange_sum + num
if green_sum == orange_sum and green_sum != 0:
print(result[0:3] + '\n')
print(result[3:6] + '\n')
print(result[6:9] + '\n')
break
usage

1)type in the numbers, and separate them with 'space'
2)type in 'Enter'
3)'1' stands for green, and '2' stands for orange

1)输入数字,用空格分隔
2)输入回车
3) '1'代表绿色,'2'代表橙色