1 | initial version |
Here your list is a list of lists containing a single string representing your integer. You can transform it to a list of integers:
sage: mylist = [['1'],['2'],['3']]
sage: mylist
[['1'], ['2'], ['3']]
sage: [ZZ(i[0]) for i in mylist]
[1, 2, 3]
sage: prod([ZZ(i[0]) for i in mylist])
6
2 | No.2 Revision |
Here your list is a list of lists containing lists, each one contains a single string representing your integer. You can transform it to a list of integers:integers as follows:
sage: mylist = [['1'],['2'],['3']]
sage: mylist
[['1'], ['2'], ['3']]
sage: [ZZ(i[0]) for i in mylist]
[1, 2, 3]
sage: prod([ZZ(i[0]) for i in mylist])
6
3 | No.3 Revision |
Here your list is a list of lists, each one contains a single string representing your integer. You can transform it to a list of integers as follows:
sage: mylist = [['1'],['2'],['3']]
sage: mylist
[['1'], ['2'], ['3']]
sage: [ZZ(i[0]) for i in mylist]
[1, 2, 3]
sage: prod([ZZ(i[0]) for i in mylist])
6
By the way, yo do not have to import the prod()
function from numpy
, Sage already have its own.
4 | No.4 Revision |
Here your list is a list of lists, lists (you can see this by the nested brackets), each one contains a single string representing your integer. integer (you can see this by the quotes). You can transform it to a list of integers as follows:
sage: mylist = [['1'],['2'],['3']]
sage: mylist
[['1'], ['2'], ['3']]
sage: [ZZ(i[0]) for i in mylist]
[1, 2, 3]
sage: prod([ZZ(i[0]) for i in mylist])
6
By the way, yo do not have to import the prod()
function from numpy
, Sage already have its own.