Skip to content

Latest commit

 

History

History
127 lines (84 loc) · 4.9 KB

step02.md

File metadata and controls

127 lines (84 loc) · 4.9 KB
layout title nav_order
default
Step 2 - Intro, and "Quit" option
20

{{page.title}}

Personal Movie Database 🎥 🎦 🎞️ 🍿 📺 🎬

Read these guidelines in their entirety before implementing anything.

In this project, similar in structure to the Week 7 and 8 labs, you will create a Movie Database Management System!

Incorporate functions from multiple labs to implement an interactive program, which you can use to collect and create data needed to store the necessary information.

This project is intended to be implemented in an IDE, which will allow you to run your code interactively. You will need to create several files in order to implement and test your functions as well as to run your main program.

The “Getting Started” section shows you the steps to modify the Main Program (Template), so that within 15-20 minutes, you should be able to have a fully running skeleton of the system.

Table of Contents

  1. Introduction
  2. Main Menu
  3. Main Program (Template)
  4. Getting Started
  5. Create the test file

Introduction

You will implement the following features for this system:

  • Create an interface that allows the users to interact with the system (will use while True and input() to collect user data).
  • Create a collection to store the movie item information that the users can view and maintain by adding and editing entries.
  • Allow the user to save the state of the system by saving the information to file and retrieving it from it.

You can re-use some code that you wrote in previous labs.

Back to top


Main Menu

In your main program (main.py), you need to define a dictionary that has the options shown below.

    "L" : "List"
    "A" : "Add"
    "U" : "Update"
    "D" : "Delete"
    "F" : "Filter"
    "S" : "Save data to file"
    "R" : "Restore data from file"
    "Q" : "Quit this program"

The menu should be printed by the print_options() function when the user starts this system.

  • 🎊 You already implemented this function in the prior lab: 7.20 LAB (Project Component): Formatted Options
  • You can copy it directly into the functions.py.
  • If you are having trouble locating that file, you can always look at your past Gradescope and zyLabs submissions for it.
  • This function does not return anything, it just prints the correctly-formatted options that are provided in the dictionary.

Back to top


Main Program (Template)

Use the following starter code to implement the main loop for your program:

from functions import *

if __name__ == "__main__":
    ... = {} # TODO 0: add the options from the instructions
    opt = None

    while True:
        ... # TODO 1: define the function, then call it with the above options as an argument
        print("::: Enter an option")
        opt = input("> ")

        if opt == ...: # TODO 2: make Q or q quit the program
            print("Goodbye!\n")
            break # exit the main `while` loop
        else:
            if ...: # TODO 3: check of the character stored in opt is in options dictionary
                print(f"You selected option {opt} to {...[opt]}.")
            else:
                print(f"WARNING: {opt} is an invalid option.\n")

    print("Have a fantabulous day!")

Important: Every time you see the ::: and > in the prompts, it denotes the call to the input() function as shown in the starter code. After the "::: Press Enter to continue" prompt is displayed and the user presses Enter, the system is set up to print the menu at the start of the loop.

Back to top


Getting Started

  1. Create the requested Python files (see instructions in [Step 1]({{ site.url }}{{ site.baseurl }}/step01).
  2. Copy the above template into your main program file.
  3. Upload the files to Gradescope to ensure the names are correct. You will need to submit all files at the same time to Gradescope (not in zyBooks).
  4. Address the TODO comments in the code (including adding the print_options() to the functions.py)

Now, you are ready to create the if/elif branches to call the functions for the various menu options. In the rest of the instructions, you will get to implement the rest of the options, defining the needed functions, and calling them (remember to remove the TODO comments).

Back to top


Submit the three files to Gradescope

TODO: Once you assembled the above template and your main program, and the testing code runs without any errors, submit your files to Checkpoint 1 on Gradescope.

You should at least pass the basic "Check required files" test, but you might be passing a few more as well.

You should now have a basic structure for the system, and you are ready to begin implementing each option.