April 2018
Beginner
340 pages
7h 54m
English
Within your casino folder, create three files to house these. Name them hand.py, deck.py, and card.py.
In each one, paste in the code from the relevant class.
If you are using an IDE with syntax checking, you may notice a few errors. These are due to the now-missing imports.
In deck.py, ensure you have the following imports:
import randomfrom .card import Card
The random module is needed to shuffle our deck.
The Deck class also relies on having instances of our Card class, so we need to ensure we have access to it. We achieve this by using a relative import.
The relative import is indicated by a single or double dot in front of the module name. In this case, .card tells Python to import from a module named card, which is ...
Read now
Unlock full access