MCPcopy Index your code
hub / github.com/geekcomputers/Python / deduct_balance

Method deduct_balance

bank_managment_system/backend.py:115–124  ·  view source on GitHub ↗
(self, amount, acc_no)

Source from the content-addressed store, hash-verified

113 self.conn.commit()
114
115 def deduct_balance(self, amount, acc_no):
116 self.cur.execute("SELECT balance FROM bank WHERE acc_no=?", (acc_no,))
117 bal = self.cur.fetchone()
118 if bal and bal[0] >= amount:
119 self.cur.execute(
120 "UPDATE bank SET balance=balance-? WHERE acc_no=?", (amount, acc_no)
121 )
122 self.conn.commit()
123 return True
124 return False
125
126 def check_balance(self, acc_no):
127 self.cur.execute("SELECT balance FROM bank WHERE acc_no=?", (acc_no,))

Callers 1

deduct_moneyFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected