observer pattern def complete(self)self user add_experience( self user wallet increase_balance( for badge in self user badgesif self _type =badge _typebadge add_points( class user(object)def __init__(selfwallet)self wallet wallet self badges [self experience def add_experience(selfamount)self experience +amount def __str__(self)return "wallet\ {}\nexperience\ {}\nbadges +\ {} ++++++++++++++++formatself walletself experience"\njoin(str(xfor in self badges]class wallet(object)def __init__(self)self amount def increase_balance(selfamount)self amount +amount def decrease_balance(selfamount)self amount -amount def __str__(self)return str(self amount