- Create a
School
class with instance attributecapacity
. - Add
students
as the class attribute. This will be a list and keep track of the students in the school. - Create a
Student
class with attributes:name
,age
,gender
- Add
__str__
method to this class to print the objects. - Add
add_student
method to the class. If capacity is full print error message else add the student. - Add
print_students
method to print the all existing students. Loop through the students list and print each student object. - Create a
School
object and threee students, add first 2 students to school. Print students and afterwards try to add the third student. - Use
__dict__
method to see attributes
- Write a
Rectangle
class, allowing you to build a rectangle withlength
andwidth
attributes. - Create a
perimeter()
method to calculate the perimeter of the rectangle and anarea()
method to calculate the area of the rectangle. - Create a method
display()
that displays the length, width, perimeter and area of an object created using an instantiation onRectangle
class.
- Create a Python class called
BankAccount
which represents a bank account, having as attributes:accountNumber
,name
,balance
. - Create a constructor with parameters:
accountNumber
,name
,balance
. - Create a
deposit()
method which manages the deposit actions. (deposit() method will take parameter d and you will increase the balance with the amount d) - Create a
withdrawal()
method which manages withdrawals actions. (withdrawal() method will take parameter w, you will reduce the amount of balance with w, if w is larger than the balance: then printImpossible operation! Insufficient balance!"
) - Create a
bankFees()
method to apply the bank fees with a percentage of 5% of the balance account. (When this method is called, the balance amount should reduce 5%) - Create a
display()
method to display account details.
Classes: Dealing with Complex Numbers: https://www.hackerrank.com/challenges/class-1-dealing-with-complex-numbers/problem
If you haven't been given specifics for a task, use your judgement to best solve the problem. You have the freedom and flexibility to use your creativity for tasks that might be uncertain to you.