创建12 *表作为矩阵

时间:2015-12-05 01:47:51

标签: python

代码旨在创建一个最大值为12 * m的12 *表。

代码返回一个空列表,它应返回12 * 12表。

from numpy import matrix


def times_twelve(m):

    max_numb = m*12
    list_of_A = []
    for n in range(1 ,13):
        list_of_A.append(max_numb - (12 - n))
    return list_of_A


def twelve_times_table(largest_numb_in_table):

    count = 1
    lists_of_lists_of_twelve = []
    while count >= largest_numb_in_table:
        lists_of_lists_of_twelve.append(times_twelve(count))
        count += 1
    times_table = matrix(lists_of_lists_of_twelve)
    return times_table


print twelve_times_table(12)

我正确使用矩阵命令吗?

0 个答案:

没有答案