Aug-18-2017, 12:27 PM
(Aug-17-2017, 12:52 PM)sparkz_alot Wrote: You use the ".extend" by using lists. So for example, if "first", "second" and "third" were lists rather than tuples, you could use ".extend" with them, ie "first.extend(iterable)". The "return" is placed at the end of the function and in general returns the results of what happens within the function.
def mult(x, y): result = x * y return result no_1 = 2 no_2 = 4 product = mult(no_1, no_2) print(product)In your situation, it's not just that you know how the trick is played, but also the math on which the trick is based. Here is a pretty good explanation of that math: Math behind 21 Card Trick.
If it were me, I would start with a main list of all 21 cards, and first, second, third start as empty lists which could be filled at a later time (within a function), you need to deal the cards, display the cards, ask for user choice, collect the cards (each step 3 times), finally reveal the eleventh card.
To be honest, I can't help but feel that either your answer or perhaps some snippets from the assignment are based on the program by dylanfw on GH.
Can anyone show me what this would look like?