Task: Create a Car Class
Objective: Create a Python program that uses a class to store and
display car details.
Requirements:
1. Create a class Car with the following attributes:
brand
model
year
2. Define the following methods:
set_details(brand, model, year) → Set values for the car
attributes.
display_details() → Display the car's details.
Create two Car objects, set their details, and display their
information.
Task: Create a Bank Account Class
Objective: Create a class to manage bank account details.
Requirements:
1. Create a class BankAccount with the following attributes:
account_holder
balance
2. Define the following methods:
set_details(account_holder, balance) → Set values for account
details.
deposit(amount) → Add the amount to the balance.
withdraw(amount) → Subtract the amount from the balance (if
sufficient funds).
display_balance() → Show the current balance.
Create two bank account objects, set details, perform transactions,
and display the final balance.
Task: Create a Library Book Class
Objective: Create a class to manage book details.
Requirements:
1. Create a class Book with the following attributes:
title
author
available (Boolean: True if available, False if borrowed)
2. Define the following methods:
set_details(title, author) → Set values for book details.
borrow_book() → Change available to False if the book is
available, otherwise display "Book is already borrowed."
return_book() → Change available to True when the book is
returned.
display_details() → Show the book's title, author, and
availability status.
3. Create two book objects, set details, borrow a book, return a
book, and display the book details.