class problems in python code example

Example 1: python oops practice questions

class MinimumBalanceAccount(BankAccount):
    def __init__(self, minimum_balance):
        BankAccount.__init__(self)
        self.minimum_balance = minimum_balance

    def withdraw(self, amount):
        if self.balance - amount < self.minimum_balance:
            print('Sorry, minimum balance must be maintained.')
        else:
            BankAccount.withdraw(self, amount)

Example 2: create a student class and initialize it with name and roll number in python

class Student():
  def __init__(self,name,roll):
    self.name = name
    self.roll= roll
  def display(self):
    print self.name
    print self.roll
  def setAge(self,age):
    self.age=age
  def setMarks(self,marks):
    self.marks = marks