Matchings · Bipartite Graphs

Lesson 7

Nikolai Chukhin · Alexander S. Kulikov

Programming problem.

Implement the following magic trick. The audience pulls five cards from the deck (in this task, these are numbers from 0 to 51), after which the magician's assistant looks at them carefully, puts one down, and lays out the remaining four cards on the table in a row. After that, the magician appears and uses the cards lying on the table to determine the postponed fifth card.

To do this, implement two functions, \(\texttt{assist}\) and \(\texttt{guess}\). The former one receives a set of five different numbers from the range \(0,\dotsc,51\) and returns a list of four cards from this set, and the latter one determines the remaining number based on the list.

There can only be two names in the global scope of your code, \(\texttt{assist}\) and \(\texttt{guess}\). If you need to import any modules, do it inside the functions.

1 point
Public samples
Public sample 1
Input
wow
Expected output
nice