Computing Concepts With Python

An interactive textbook teaching basic concepts of computer science and programming.

This project is maintained by brendanpshea

PyQuiz: Interactive Python Coding Practice Tool

PyQuiz is an interactive Python coding practice tool designed to help students learn and practice Python programming through a series of coding questions. It provides a user-friendly interface using IPython widgets, making it ideal for use in Jupyter notebooks or similar interactive Python environments.

Features

Installation

  1. Ensure you have Python 3.x installed on your system.
  2. Install the required dependencies:

    pip install ipywidgets pandas numpy
    
  3. Download the pyquiz.py file from the GitHub repository:

    wget https://github.com/brendanpshea/computing_concepts_python/raw/main/python_code_quiz/pyquiz.py
    

Usage

  1. In your Jupyter notebook or interactive Python environment, import the PracticeTool class:

    from pyquiz import PracticeTool
    
  2. Create an instance of the PracticeTool class, specifying the path to your JSON file containing the questions:

    practice_tool = PracticeTool(json_url='path_to_your_questions.json')
    

    You can also use a URL to load questions from a remote source:

    practice_tool = PracticeTool(json_url='https://example.com/questions.json')
    
  3. The tool will automatically display and allow interaction with the coding questions.

Creating Custom Questions

To create your own set of questions, prepare a JSON file in the following format:

{
  "questions": [
    {
      "function_name": "example_function",
      "parameters": ["param1", "param2"],
      "description": "Write a function that does X",
      "input_type": ["int", "string"],
      "answer_code": "def example_function(param1, param2):\n    # Correct implementation here\n    return result",
      "hint": "Consider using method Y",
      "test_inputs": [[1, "a"], [2, "b"]]
    },
    // Add more questions here
  ]
}

Features in Detail

Question Display

Code Input

Test Execution

Hint System

Progress Tracking

Program Output

Contributing

Contributions to improve PyQuiz are welcome. Please feel free to submit pull requests or open issues on the GitHub repository.

License

This project is open source and available under the MIT License.

Acknowledgments