- Create a
Schoolclass with instance attributecapacity. - Add
studentsas the class attribute. This will be a list and keep track of the students in the school. - Create a
Studentclass with attributes:name,age,gender - Add
__str__method to this class to print the objects. - Add
add_studentmethod to the class. If capacity is full print error message else add the student. - Add
print_studentsmethod to print the all existing students. Loop through the students list and print each student object. - Create a
Schoolobject 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
Rectangleclass, allowing you to build a rectangle withlengthandwidthattributes. - 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 onRectangleclass.
- Create a Python class called
BankAccountwhich 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.