From 49fc274da3bc6592d1b097a8ed70b813b837fe43 Mon Sep 17 00:00:00 2001 From: rama nahawandi Date: Wed, 19 Oct 2022 22:04:21 +0200 Subject: [PATCH 1/3] finished first excersice --- school.py | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 school.py diff --git a/school.py b/school.py new file mode 100644 index 0000000..c5327e5 --- /dev/null +++ b/school.py @@ -0,0 +1,50 @@ +class School: + students =[] + + def __init__(self, capacity): + self.capacity = capacity + + def add_students(self,std): + if len(self.students) Date: Wed, 19 Oct 2022 22:20:46 +0200 Subject: [PATCH 2/3] finished Rectangle excersice --- Rectangle.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 Rectangle.py diff --git a/Rectangle.py b/Rectangle.py new file mode 100644 index 0000000..b87a8ec --- /dev/null +++ b/Rectangle.py @@ -0,0 +1,17 @@ +class Rectangle: + + def __init__(self,width,length): + self.width=width + self.length=length + + def perimeter(self): + return 2*(self.length+self.width) + + def area(self): + return self.length*self.width + + def display(self): + print("Width is:", self.width, "\nLength is:", self.length, "\nArea is:",self.area(), "\nPerimeter is:", self.perimeter()) + +rec1=Rectangle(3,4) +rec1.display() \ No newline at end of file From 190335613deb0e09908bdfdf05f4ce8f0e5ab773 Mon Sep 17 00:00:00 2001 From: rama nahawandi Date: Wed, 19 Oct 2022 22:40:24 +0200 Subject: [PATCH 3/3] finished BankAccount excersice --- BankAccount.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 BankAccount.py diff --git a/BankAccount.py b/BankAccount.py new file mode 100644 index 0000000..477e61d --- /dev/null +++ b/BankAccount.py @@ -0,0 +1,25 @@ +class BankAccount: + def __init__(self,accountNumber,name,balance): + self.accountNumber=accountNumber + self.name=name + self.balance=balance + def deposit(self,d): + self.balance+=d + def withdrawal(self,w): + if w <= self.balance: + self.balance-=w + else: + print ("Impossible operation! Insufficient balance!") + def bankFees(self): + self.balance -= (0.05* self.balance) + def display(self): + print(vars(self)) + +account1 = BankAccount(1,"rama",100) +account1.display() +account1.deposit(200) +account1.display() +account1.bankFees() +account1.display() +account1.withdrawal(50) +account1.display()