I used Python long time ago and decided to revisit it. Downloaded the latest version (3.3.2) and tried to execute a few codes. First thing I learned is that print is now a function. Having in mind this is a fully operational code I can't figure out why it doesn't work now.
Table= [[ 0 for i in range(9)] for j in range(9) ]
for x in range(9):
for y in range(9):
if x==0 or x==8 or y==0 or y==8 or (x==4 and y==3) or (x==4 and y==4) or (x==4 and y==5):
Table[x][y]=1;
for y in range(9):
for x in range(9):
print Table[x][y],
print
When I go "Run Module" a SyntaxError window pops up. The marked phrase being the error is the Table[x][y] in the 2nd row from the bottom. I'm pretty sure this worked last time I tried it. Thanks!
Putting your code into a file too.py
, I ran the 2to3 utility to convert it to Python3 code:
→ 2to3 too.py
RefactoringTool: Skipping implicit fixer: buffer
RefactoringTool: Skipping implicit fixer: idioms
RefactoringTool: Skipping implicit fixer: set_literal
RefactoringTool: Skipping implicit fixer: ws_comma
RefactoringTool: Refactored too.py
--- too.py (original)
+++ too.py (refactored)
@@ -5,5 +5,5 @@
Table[x][y]=1;
for y in range(9):
for x in range(9):
- print Table[x][y],
- print
+ print(Table[x][y], end=' ')
+ print()
RefactoringTool: Files that need to be modified:
RefactoringTool: too.py