This Python script provides a command-line interface for creating, managing, studying, and editing flashcard decks. It allows users to organize their study material into decks of cards, each containing a question and an answer. The tool supports features like spaced repetition for studying, deck import/export, and various editing options.
Create Decks: Easily create new flashcard decks by providing a name and adding cards with questions and answers.
Select Decks: Choose from existing decks to study or edit.
Study Decks: Study cards using a basic spaced repetition algorithm. Cards reviewed incorrectly appear more frequently.
Edit Decks:
Edit Cards: Modify the question or answer of existing cards.
Sort Cards: Sort cards within a deck alphabetically by question or answer, or by the date they were created.
Search Cards: Find specific cards by searching for a keyword in the question.
Add Cards: Add new cards to an existing deck.
Export Decks: Save a copy of a selected deck to a specified directory.
Import Decks: Load decks from .csv
files into the application.
- Python 3.x installed on your system.
- Save the provided Python code as a
.py
file (e.g.,flashcards.py
). - Create a directory named
Decks
in the same location as the Python script. This is where your decks will be stored by default.
- Open your terminal or command prompt.
- Navigate to the directory where you saved the
flashcards.py
file. - Run the script using the command:
python flashcards.py
The application presents a menu with the following options:
- Make Deck: Guides you through the process of creating a new deck by entering a name and adding question-answer pairs.
- Select Deck: Lists the available decks in the
Decks
directory and allows you to choose one for studying or editing. - Study Deck: Initiates the study mode for the selected deck. Cards are presented, and you can indicate whether you answered correctly to adjust their review frequency.
- Edit Deck: Provides a submenu with options to edit existing cards, sort the deck, search for cards, or add new cards.
- Export Deck: Allows you to save a copy of the currently selected deck to a location of your choice.
- Import Deck: Enables you to load a deck from a
.csv
file located elsewhere on your system. - Exit: Closes the application.
Decks are stored as .csv
files in the Decks
directory. Each row in the .csv
file represents a flashcard with the question, answer, and creation date separated by commas.
HashTable
: A basic hash table implementation used for efficient searching of cards by question within a deck. It uses linear probing for collision resolution and supports insertion, retrieval, and deletion of key-value pairs.PriorityQueue
: A priority queue implementation using theheapq
module. It is used in theDeckSchedule
to manage the order in which cards are presented for studying based on their review time.Deck
: The main class for managing flashcard decks. It provides methods for creating, selecting, extracting, importing, exporting, studying, and editing decks.Card
: Represents a single flashcard with attributes for the question, answer, creation date, and review time.DeckSchedule
: Manages the scheduling of cards for studying using a priority queue. It keeps track of when cards should be reviewed next.
printCards(deck)
: Prints the question, answer, and creation date of all cards in a given deck with an index for easy selection.quickSort(ar, low, high, obj_func)
: Implements the quicksort algorithm to sort a list ofCard
objects based on a specified attribute (answer
,question
, ordate
).main()
: The main function that runs the application loop and handles user interactions with the menu.
- The maximum number of cards allowed in a single deck is 100.
- Deck names cannot contain the following characters:
\
,/
,:
,*
,?
,"
,<
,>
,|
. - Imported deck files must have a header row:
question,answer,date_created
.
This project is licensed under the MIT License. See the LICENSE
file for more information