Ask Your Question

How to correct this Error?

asked 2015-10-08 19:58:51 -0500

Chernoxyl gravatar image

I was using the Cartesian Product function when it gave me an "unhashable list" error. What does this mean and how would I correct it?

As for code, I used the Cards, Values, and Suits from the Combinatorics Comprehensive Module Index.

edit retag flag offensive close merge delete



Could you be more precise? Could you write down the code you were using?

vdelecroix gravatar imagevdelecroix ( 2015-10-08 21:44:13 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2015-10-09 11:57:44 -0500

fidbc gravatar image

Perhaps doing it as shown here might help (code below).

sage: Suits = Set(["Hearts", "Diamonds", "Spades", "Clubs"])
sage: Values = Set([2, 3, 4, 5, 6, 7, 8, 9, 10,
...                 "Jack", "Queen", "King", "Ace"])
sage: Cards = CartesianProduct(Values, Suits)

Just ran this code and it didn't produce any errors.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2015-10-08 19:58:51 -0500

Seen: 195 times

Last updated: Oct 09 '15