Ask Your Question

# Revision history [back]

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


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


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.

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.