Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

4a. In the card game Set, the deck consists of 81 cards, each with four attributes: number (one, two, three) color (red, green, purple) shape

4a. In the card game Set, the deck consists of 81 cards, each with four attributes:

  • number (one, two, three)
  • color (red, green, purple)
  • shape (diamond, squiggle, oval)
  • texture (open, solid, striped). Each possible combination of attributes occurs exactly once. Build a Python list of tuples representing this deck; each tuples should include the four attributes in the order given above.

4b. Define a function is_set that, on input three distinct cards from your deck, returns True if and only if they form a "set" according to the rules of the game. That is, in each of the four attributes, they are either all the same (say, all green) or all different (say, one red, one green, one purple), not two of one and one of another (say, two greens and a red). If possible, make this a lambda function.

4c. In the game, one normally looks at twelve cards at a time and attempts to find a set among these. Write a lambda function that, given a list of cards, returns True if and only if it contains a set. Your answer may use the function is_set that you defined in 4b.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Transactions On Large Scale Data And Knowledge Centered Systems Xxviii Special Issue On Database And Expert Systems Applications Lncs 9940

Authors: Abdelkader Hameurlain ,Josef Kung ,Roland Wagner ,Qimin Chen

1st Edition

3662534541, 978-3662534540

More Books

Students also viewed these Databases questions