Skip to content

Repository files navigation

🐍 Python OOP Practice Tasks

This repository contains beginner to intermediate Python tasks designed to help learners understand Object-Oriented Programming (OOP) concepts such as:

  • ✅ Creating and using classes
  • ✅ Defining attributes and methods
  • ✅ Using constructors (__init__)
  • ✅ Working with objects (instances)
  • ✅ Encapsulation (storing and managing data inside objects)

Each task is designed to be real-life relatable so learners can understand why and how OOP is useful in solving practical problems.


📘 Table of Contents

  1. Voting System
  2. Attendance Register
  3. Bank Account Simulation
  4. Library Management System
  5. Student Grading System
  6. Simple Calculator (OOP Version)
  7. To-Do List Manager
  8. Inventory Management
  9. Restaurant Ordering System
  10. Hospital Patient Management
  11. Course Registration System
  12. Employee Payroll System
  13. Movie Ticket Booking
  14. E-commerce Shopping Cart

🔹 Tasks

1. Voting System

Create a VotingSystem class that allows:

  • Registering candidates
  • Casting votes
  • Displaying results

🔑 Concepts: Class attributes, updating dictionaries, method calls.


2. Attendance Register

Create an AttendanceRegister class that allows:

  • Adding students
  • Marking attendance (Present/Absent)
  • Displaying attendance records

🔑 Concepts: Class methods, lists/dictionaries as attributes.


3. Bank Account Simulation

Create a BankAccount class that allows:

  • Depositing money
  • Withdrawing money
  • Checking balance

🔑 Concepts: Encapsulation, state management, error handling.


4. Library Management System

Create a Library class that allows:

  • Adding books
  • Borrowing books
  • Returning books
  • Displaying available books

🔑 Concepts: Object collection, updates, validation.


5. Student Grading System

Create a GradingSystem class that allows:

  • Recording student grades
  • Calculating averages
  • Determining letter grades (A, B, C, etc.)

🔑 Concepts: Dictionaries, conditionals inside methods.


6. Simple Calculator (OOP Version)

Create a Calculator class that allows:

  • Addition, subtraction, multiplication, division
  • Handling invalid inputs (like division by zero)

🔑 Concepts: Methods for mathematical operations, input validation.


7. To-Do List Manager

Create a TodoList class that allows:

  • Adding tasks
  • Updating tasks (completed/pending)
  • Viewing all tasks

🔑 Concepts: Lists as storage, methods to manage status.


8. Inventory Management

Create an Inventory class that allows:

  • Adding items with quantity
  • Updating stock when items are sold
  • Displaying current stock

🔑 Concepts: Class attributes, dictionaries, real-world simulation.


9. Restaurant Ordering System

Create an OrderSystem class that allows:

  • Adding menu items
  • Taking customer orders
  • Displaying total bill

🔑 Concepts: Object storage, iteration, basic arithmetic.


10. Hospital Patient Management

Create a Hospital class that allows:

  • Adding patients
  • Assigning doctors
  • Displaying patient records

🔑 Concepts: Nested data structures, OOP relationships.


11. Course Registration System

Create a CourseRegistration class that allows:

  • Adding courses
  • Enrolling students in courses
  • Displaying enrolled students

🔑 Concepts: Lists/dictionaries, multiple object tracking.


12. Employee Payroll System

Create a PayrollSystem class that allows:

  • Adding employees with salaries
  • Calculating total payroll
  • Giving salary raises

🔑 Concepts: Arithmetic in methods, managing multiple objects.


13. Movie Ticket Booking

Create a TicketBooking class that allows:

  • Displaying available seats
  • Booking tickets
  • Canceling tickets

🔑 Concepts: Updating lists/dictionaries, validations.


14. E-commerce Shopping Cart

Create a ShoppingCart class that allows:

  • Adding products to cart
  • Removing products
  • Checking out (total price)

🔑 Concepts: Real-world application of OOP, aggregation.


🚀 How to Use

  1. Clone or download this repo.
  2. Open the .py files for each task.
  3. Run them in your terminal or IDE.
  4. Try extending each class by adding more features.

🎯 Learning Outcomes

By completing these tasks, you will:

  • Understand the basics of OOP in Python

  • Learn to design real-world applications using classes

  • Transition easily into more advanced OOP concepts like:

    • Inheritance
    • Polymorphism
    • Abstraction

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages