Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python Programming Lab (PPL)

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.

Requirements

  • Python 3.10 or newer (the tool uses match statements and modern type hints).
  • The NumPy package, used for the matrix exercise.

Setup

pip install -r requirements.txt

Usage

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").
110 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.

Example

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.

The 10 exercises

  1. Count the number of even/odd numbers in a given list.
  2. Count the number of digits and letters in a given text.
  3. Validate a password (lower/upper case letter, digit, special character $#@, length 6–16).
  4. Calculate the sum and average of numbers entered by the user (0 to finish).
  5. Count the upper case and lower case letters in a string.
  6. Generate the Fibonacci series with a while loop.
  7. Calculate a factorial using recursion.
  8. Search a sorted list with the binary search algorithm.
  9. Find the most frequent word in a piece of text (written to and read back from a file).
  10. Perform matrix addition, subtraction and element-wise multiplication.

Jupyter notebook

PPL.ipynb contains the same 10 exercises as standalone, self-contained code cells, useful for stepping through and submitting them individually.

Contributing

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!

License

This tool is licensed under the MIT License. See LICENSE for more information.

About

Interactive CLI for 10 classic Python programming-lab exercises, presented as Aim / Algorithm / Program / Output / Result

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages