Skip to content

Instantly share code, notes, and snippets.

@kastaneda
Created February 27, 2012 18:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kastaneda/1925978 to your computer and use it in GitHub Desktop.
Save kastaneda/1925978 to your computer and use it in GitHub Desktop.
Learning Python
#!/usr/bin/python
# this works as I expect, result is [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
q = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]
# this works strange, result is [[7, 8, 9], [7, 8, 9], [7, 8, 9]]
q = [[0]*3]*3
z = 0
for y in range(3):
for x in range(3):
z = z+1
q[y][x] = z
print q
@kastaneda
Copy link
Author

Проверка возможности писать кириллицей.

@kastaneda
Copy link
Author

А теперь в блоке кода…

print u"Привет, мир!"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment