magic-square
所属分类:数据结构
开发工具:Python
文件大小:0KB
下载次数:0
上传日期:2018-09-19 03:25:15
上 传 者:
sh-1993
说明: Python编程语言的幻方数据结构
(A magic square data structure for the Python programming language)
文件列表:
LICENSE (1070, 2018-09-18)
magic_square/ (0, 2018-09-18)
magic_square/__init__.py (0, 2018-09-18)
magic_square/magic_square.py (4651, 2018-09-18)
setup.py (627, 2018-09-18)
## What it is
A magic square data structure for the Python programming language.
## How to use it
```python
my_magic_square = magic_square.MagicSquare(3, 15) # initialize a new 3X3 magic square with magic constant of 15
my_magic_square.set(0, 0, 5) # set the cell at position (0, 0) to 5
my_magic_square.is_valid() # False
my_magic_square.rotate(-27) # rotates magic square clockwise 27 times
print(my_magic_square)
print(my_magic_square.center_of_mass())
print(my_magic_square.moment_of_inertia())
```
近期下载者:
相关文件:
收藏者: