2015-11-06 45 views
1

我'Python的初學者,我學習布爾代數,和我在測試這個功能:使用pyeda功能得到以下錯誤

from pyeda.inter import * 

list(iter_points([z, y, x])) 

[{x: 0, y: 0, z: 0}, 
{x: 0, y: 0, z: 1}, 
{x: 0, y: 1, z: 0}, 
{x: 0, y: 1, z: 1}, 
{x: 1, y: 0, z: 0}, 
{x: 1, y: 0, z: 1}, 
{x: 1, y: 1, z: 0}, 
{x: 1, y: 1, z: 1}] 

我已經安裝pyeda。

當我執行文件,我已經得到了以下錯誤:

回溯(最近通話最後一個): 文件 「tabela.py」,3號線,在 列表(iter_points [Z,Y,X ]) NameError:名稱'z'未定義

任何人都可以幫助我解決這個問題?

感謝我很多傢伙。

BM

回答

0
x = 0 
y = 0 
z = 0 

print(list(iter_points([z, y, x]))) 

同時刪除X/Y/Z,你在這裏展示列表。這是你的結果應該是什麼樣子。

1

PyEDA筆者在這裏:

試試這個:

>>> from pyeda.inter import * 
>>> x, y, z = map(exprvar, 'xyz') 
>>> list(iter_points([z, y, x]))