``` class Balance: def __init__(self): self.bal = 0 def add(self, x): self.bal += x return self def deduct(self, x): self.bal -= x return self b = Balance() b.add(7).deduct(2).add(5) print(b.bal) ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up