Ask Your Question

How to correct this Error?

asked 2015-10-09 02:58:51 +0200

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-09 04:44:13 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2015-10-09 18:57:44 +0200

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-09 02:58:51 +0200

Seen: 356 times

Last updated: Oct 09 '15