AutomateTheBoringStuff.Ch05 package¶
Subpackages¶
Submodules¶
AutomateTheBoringStuff.Ch05.P1_birthdays module¶
Birthdays
This program makes a birthday database using a dict
.
AutomateTheBoringStuff.Ch05.P2_characterCount module¶
Character count
This program counts how often each character appears in a string.
AutomateTheBoringStuff.Ch05.P3_prettyCharacterCount module¶
Pretty character count
This program also counts the number of times a character appears in a string
but with a prettier output via the pprint
module.
AutomateTheBoringStuff.Ch05.P4_ticTacToe module¶
Tic Tac Toe
This program plays a game of tic-tac-toe using a dict
to store the board.
-
AutomateTheBoringStuff.Ch05.P4_ticTacToe.
theBoard
¶ Dictionary containing the current status of the tic-tac-toe board.
Type: dict
Note
Space names are defined as follows:
top-L | top-M | top-R ------+-------+------ mid-L | mid-M | mid-R ------+-------+------ low-L | low-M | low-R
Intended for two players.
AutomateTheBoringStuff.Ch05.P5_totalBrought module¶
Total brought
This program totals everything being brought to a picnic
by storing the guest’s names and items brought as a dict
of dicts
.
-
AutomateTheBoringStuff.Ch05.P5_totalBrought.
allGuests
¶ Dictionary of dictionaries with guest names as keys and values of dictionaries with items as keys and number of items as values.
Type: dict
-
AutomateTheBoringStuff.Ch05.P5_totalBrought.
totalBrought
(guests: dict, item: str) → int[source]¶ Total brought
Totals given item from given guest dictionary and returns result.
Parameters: - guests – Dictionary with guest’s names and what they are bringing.
- item – Specific item in guest dictionary that is to be totaled.
Returns: Integer total of given item that will be brought.