A command-line tool that walks through 10 classic introductory programming exercises, one at a time, in the same format used for a lab record: Aim → Algorithm → Program → Output → Result.
- Python 3.10 or newer (the tool uses
matchstatements and modern type hints). - The NumPy package, used for the matrix exercise.
pip install -r requirements.txt
Run the tool from the project directory:
python PPL.py
You'll see a welcome message and a prompt. Type one of the following commands and press Enter:
| Command | What it does |
|---|---|
lop |
Lists all 10 available programs (their "Aim"). |
1–10 |
Runs the chosen exercise: shows its Aim, Algorithm and Program source, then asks for input and prints the Output and Result. |
cls |
Clears the screen and shows the welcome message again. |
e |
Exits the tool. |
Enter your command: 1
Aim:
Write a Python program to count the number of even/odd numbers in a given list.
Algorithm:
1. Read a list of integers from the user.
2. Initialise odd and even counters to 0.
3. For each number, increment even if it is divisible by 2, else increment odd.
4. Display the odd and even counts.
Program:
...
Input:
Enter the list (separated by spaces): 1 2 3 4 5
Output:
Number of odd numbers: 3
Number of even numbers: 2
Result:
Thus the above code was executed successfully.
- Count the number of even/odd numbers in a given list.
- Count the number of digits and letters in a given text.
- Validate a password (lower/upper case letter, digit, special character
$#@, length 6–16). - Calculate the sum and average of numbers entered by the user (
0to finish). - Count the upper case and lower case letters in a string.
- Generate the Fibonacci series with a
whileloop. - Calculate a factorial using recursion.
- Search a sorted list with the binary search algorithm.
- Find the most frequent word in a piece of text (written to and read back from a file).
- Perform matrix addition, subtraction and element-wise multiplication.
PPL.ipynb contains the same 10 exercises as standalone, self-contained code
cells, useful for stepping through and submitting them individually.
If you would like to contribute to this project, please fork the repository and submit a pull request with your changes. We welcome all contributions, big and small!
This tool is licensed under the MIT License. See LICENSE for more information.