Giter Site home page Giter Site logo

class7-python-module-week4's Introduction

Class7-Python-Module-Week4

1. School

  1. Create a School class with instance attribute capacity.
  2. Add students as the class attribute. This will be a list and keep track of the students in the school.
  3. Create a Student class with attributes: name, age, gender
  4. Add __str__ method to this class to print the objects.
  5. Add add_student method to the class. If capacity is full print error message else add the student.
  6. Add print_students method to print the all existing students. Loop through the students list and print each student object.
  7. Create a School object and threee students, add first 2 students to school. Print students and afterwards try to add the third student.
  8. Use __dict__ method to see attributes

2. Rectangle

  1. Write a Rectangle class, allowing you to build a rectangle with length and width attributes.
  2. Create a perimeter() method to calculate the perimeter of the rectangle and an area() method to calculate the area of ​​the rectangle.
  3. Create a method display() that displays the length, width, perimeter and area of an object created using an instantiation on Rectangle class.

3. BankAccount

  1. Create a Python class called BankAccount which represents a bank account, having as attributes: accountNumber, name , balance.
  2. Create a constructor with parameters: accountNumber, name, balance.
  3. 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)
  4. 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 print Impossible operation! Insufficient balance!")
  5. 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%)
  6. Create a display() method to display account details.

HackerRank Questions

Classes: Dealing with Complex Numbers: https://www.hackerrank.com/challenges/class-1-dealing-with-complex-numbers/problem

Note:

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.

class7-python-module-week4's People

Contributors

sigma21 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.