Reference no: EM132288572
Project - Dictionaries and File IO
The purpose of this assignment is to explore dictionaries and file IO.
Background: Dictionaries give an enriched way to store values by more than just sequential indexes (as lists give us); we identify key-value pairs, and treat keys like indexes of various other types. The only restriction on keys is that they are "hashable", which we can approximate by thinking that they are "immutable all the way down". Though unordered, dictionaries help us simplify many tasks by keeping those key-value associations. Each key can only be paired with one value at a time in a dictionary.
When a file contains text, we can readily write programs to open the file and compute things based on the file's contents. This also gives our programs far more longevity: we can store data and results for later, save user preferences, and all sorts of other useful things.
Problem Statement: What's the best thing for end-of-semester studying? Flashcards! We're going to write a flashcard program that can import cards and quiz you! We'll be doing lots of file input and output (I/O) for this.
Representing a Flashcard, a Deck of Flashcards, and Quiz Statistics - Define the dictionaries formats you will use.
Part 0: Setting Up Your Files
You have been given a code "skeleton" for this project (template.py) which gives the function definitions and "dummy" return statements where needed. This allows the user interface to run before you're finished with your code. Rename this file with your typical username + section-number + P5 format.
You have also been given the user interface for the quiz program (provided.py) which will use your code to drive the program. You can call it much like the tester by putting your filename after when you run it. Below is a sample run. The parts underlined in blue are entered by the user (you) as the program runs.
Part 1: Loading STR Questions from a File
In this part we will be learning to load decks from a save file. Save files have already been provided to you with this document (they are the files with the .deck extension) and in this section we will specifically be working with deck_str.deck. You can open these files with any text editor to see what they look like, you may need to right click the file and select "open with" in some operating systems.
Part 2: Quizzes! (with STR questions only)
Next we're going to do quizzes, so you're going to need to start tracking quiz statistics.
Part 3: More statistics!
We've got quizzes, so let's add some things to tell the user about how they did at the end of the quiz.
Part 4: Shuffling
Quizzes are better if your decks are shuffled. Let's try doing that...
Part 5: Importing New Questions
It turns out that users don't really like entering questions in semicolon-separated format and find it hard to read. Additionally, they don't like having to provide question ids and types for every question. We're going to build them a more "user friendly" import and let them enter questions in this format (see qs_str.txt).
Part 6: Saving
It would be nice if your users could save their imported questions (and it would be annoying to have to import them every time). So let's write .deck files!
Part 7: More Question Types (INT)
Now you've got an entire quiz program! Sadly, we don't have all the question types yet... so let's add them! Let's add the ability to load/record/import/save INT questions.
Part 8: More Question Types (MC)
Let's add the ability to load/record/import/save MC questions.
Attachment:- Assignment Files.rar