You are on page 1of 2

P=[[1,1,0,0],[1,0,1,0],[0,1,1,0],[1,1,1,0],[1,0,0,1],[0,1,0,1],[1,1,0,1]]

I=[[1,0,0,0,0,0,0],[0,1,0,0,0,0,0],[0,0,1,0,0,0,0],[0,0,0,1,0,0,0],[0,0,0,0,1,0,
0],[0,0,0,0,0,1,0],[0,0,0,0,0,0,1]]
G=[[1,1,0,0,1,0,0,0,0,0,0],[1,0,1,0,0,1,0,0,0,0,0],[0,1,1,0,0,0,1,0,0,0,0],[1,1,
1,0,0,0,0,1,0,0,0],[1,0,0,1,0,0,0,0,1,0,0],[0,1,0,1,0,0,0,0,0,1,0],[1,1,0,1,0,0,
0,0,0,0,1]]
H=[[1,0,0,0,1,1,0,1,1,0,1],[0,1,0,0,1,0,1,1,0,1,1],[0,0,1,0,0,1,1,1,0,0,0],[0,0,
0,1,0,0,0,0,1,1,1]]
Python 2.7.10 (default, May 23 2015, 09:40:32) [MSC v.1500 32 bit (Intel)]
Type "copyright", "credits" or "license" for more information.
IPython 2.4.1 -- An enhanced Interactive Python.
?
-> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help
-> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
%guiref -> A brief reference about the graphical user interface.
In [1]: FOR X = 1 TO 4
...: FOR Y = 1 TO 4
...: IF X = Y THEN
...: M(X,Y) = 1
...: ELSE
...: M(X,Y) = 0
...: END IF
...: NEXT
...: NEXT
File "<ipython-input-1-e7639b590249>", line 1
FOR X = 1 TO 4
^
SyntaxError: invalid syntax
In [2]: P=[[1,1,0,0],[1,0,1,0],[0,1,1,0],[1,1,1,0],[1,0,0,1],[0,1,0,1],[1,1,0,1]
]
...: I=[[1,0,0,0,0,0,0],[0,1,0,0,0,0,0],[0,0,1,0,0,0,0],[0,0,0,1,0,0,0],[0,0,
0,0,1,0,0],[0,0,0,0,0,1,0],[0,0,0,0,0,0,1]]
...:
In [3]: G=P+I
In [4]: g
Traceback (most recent call last):
File "<ipython-input-4-f5302386464f>", line 1, in <module>
g
NameError: name 'g' is not defined
In [5]:
Out[5]:
[[1, 1,
[1, 0,
[0, 1,
[1, 1,
[1, 0,
[0, 1,

G
0,
1,
1,
1,
0,
0,

0],
0],
0],
0],
1],
1],

[1,
[1,
[0,
[0,
[0,
[0,
[0,
[0,

1,
0,
1,
0,
0,
0,
0,
0,

0,
0,
0,
1,
0,
0,
0,
0,

1],
0, 0,
0, 0,
0, 0,
1, 0,
0, 1,
0, 0,
0, 0,

0,
0,
0,
0,
0,
1,
0,

0],
0],
0],
0],
0],
0],
1]]

In [6]: G=P*I
Traceback (most recent call last):
File "<ipython-input-6-4bbbe3a79283>", line 1, in <module>
G=P*I
TypeError: can't multiply sequence by non-int of type 'list'
In [7]: G=PI
Traceback (most recent call last):
File "<ipython-input-7-4f0c47bfac65>", line 1, in <module>
G=PI
NameError: name 'PI' is not defined
In [8]: g
Traceback (most recent call last):
File "<ipython-input-8-f5302386464f>", line 1, in <module>
g
NameError: name 'g' is not defined
In [9]:
Out[9]:
[[1, 1,
[1, 0,
[0, 1,
[1, 1,
[1, 0,
[0, 1,
[1, 1,
[1, 0,
[0, 1,
[0, 0,
[0, 0,
[0, 0,
[0, 0,
[0, 0,

G
0,
1,
1,
1,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,

0],
0],
0],
0],
1],
1],
1],
0, 0,
0, 0,
0, 0,
1, 0,
0, 1,
0, 0,
0, 0,

0,
0,
0,
0,
0,
1,
0,

0],
0],
0],
0],
0],
0],
1]]

You might also like