-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpython103_project2.py
More file actions
42 lines (33 loc) · 1.26 KB
/
python103_project2.py
File metadata and controls
42 lines (33 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 31 11:00:00 2021
Bank account using class
@author: a.bugami
"""
from datetime import datetime
class Bank_Account():
def __init__(self, name, credit=0):
self.name = name
self.credit = credit
def take_date(self):
date = datetime.now()
day = date.strftime("%A")
date2 = date.strftime("%d %B, %Y")
time = date.strftime('%H:%M%p')
return [day, date2, time]
def debt(self, amount):
self.credit += amount
datetime1 = self.take_date()
print("تم إيداع " + str(amount) +" ريال لرصيدك البنكي في يوم "+ datetime1[0]+" التاريخ "+datetime1[1]+" الساعة "+datetime1[2])
def withdraw(self, amount):
self.credit -= amount
datetime1 = self.take_date()
print("تم خصم " + str(amount) +" ريال من رصيدك البنكي في يوم "+ datetime1[0]+" التاريخ "+datetime1[1]+" الساعة "+datetime1[2])
def get_credit(self):
print("رصيدك البنكي هو "+ str(self.credit) + " ريال")
account1 = Bank_Account("Ahmad")
account1.get_credit()
account1.debt(2000)
account1.get_credit()
account1.withdraw(50)
account1.get_credit()