def deposit(self, amount): if amount <= 0: return "Amount must be positive" self.balance += amount self._log_transaction("DEPOSIT", amount) return f"Deposited $amount. New balance: $self.balance"
alice.deposit(100) print(alice.pay(30, bob))
import hashlib import uuid from datetime import datetime class SimpleWallet: def (self, user_id): self.user_id = user_id self.balance = 0.0 self.transactions = []
self.balance -= amount recipient_wallet.balance += amount
def pay(self, amount, recipient_wallet): if amount <= 0: return "Amount must be positive" if self.balance < amount: return "Insufficient balance"
print(f"Alice balance: $alice.balance") print(f"Bob balance: $bob.balance")